Skip to content

Commit

Permalink
fix: code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Nov 27, 2024
1 parent 6825a73 commit b6e37f9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"files.trimTrailingWhitespace": true,
"eslint.useFlatConfig": true
"eslint.useFlatConfig": true,
"sonarlint.connectedMode.project": {
"connectionId": "graasp",
"projectKey": "graasp_graasp-account"
}
}
2 changes: 1 addition & 1 deletion cypress/e2e/account/homePage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('Check member info', () => {
'contain',
MEMBER_WITH_AVATAR.name,
);
const lang = MEMBER_WITH_AVATAR.extra.lang || 'en';
const lang = MEMBER_WITH_AVATAR.extra.lang ?? 'en';
// displays the correct creation date
const formattedDate = formatDistanceToNow(MEMBER_WITH_AVATAR.createdAt, {
locale: getLocalForDateFns(lang),
Expand Down
42 changes: 20 additions & 22 deletions cypress/e2e/account/settings/preferences.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,32 +170,30 @@ describe('Edit preferences', () => {
});
});

describe('Email Frequency', () => {
[
{ initial: EmailFrequency.Never, final: EmailFrequency.Always },
{ initial: EmailFrequency.Always, final: EmailFrequency.Never },
].forEach(({ initial, final }) => {
it(`From ${initial} to ${final}`, () => {
cy.setUpApi({
currentMember: {
...CURRENT_MEMBER,
extra: {
...CURRENT_MEMBER.extra,
emailFreq: initial,
},
[
{ initial: EmailFrequency.Never, final: EmailFrequency.Always },
{ initial: EmailFrequency.Always, final: EmailFrequency.Never },
].forEach(({ initial, final }) => {
it(`Email Frequency from ${initial} to ${final}`, () => {
cy.setUpApi({
currentMember: {
...CURRENT_MEMBER,
extra: {
...CURRENT_MEMBER.extra,
emailFreq: initial,
},
});
cy.visit(ACCOUNT_SETTINGS_PATH);
cy.wait('@getCurrentMember');
cy.get(`#${PREFERENCES_EDIT_BUTTON_ID}`).click();
},
});
cy.visit(ACCOUNT_SETTINGS_PATH);
cy.wait('@getCurrentMember');
cy.get(`#${PREFERENCES_EDIT_BUTTON_ID}`).click();

switchEmailFreq(final);
switchEmailFreq(final);

cy.get(`#${PREFERENCES_SAVE_BUTTON_ID}`).click();
cy.get(`#${PREFERENCES_SAVE_BUTTON_ID}`).click();

cy.wait('@editMember').then(({ request }) => {
expect(request.body.extra.emailFreq).to.equal(final);
});
cy.wait('@editMember').then(({ request }) => {
expect(request.body.extra.emailFreq).to.equal(final);
});
});
});
Expand Down

0 comments on commit b6e37f9

Please sign in to comment.