Skip to content

Commit

Permalink
test: 🧪 is not allowed to update notification settings without device…
Browse files Browse the repository at this point in the history
… hash

Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Jul 1, 2024
1 parent 2597d10 commit f344142
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/graphql/resolvers/Device.integ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe('Device GraphQL API', () => {
expect(data.updateNotificationSettings.voteTOP100Pushs).toBeTruthy();
expect(data.updateNotificationSettings.outcomePushs).toBeTruthy();
});

it('get updated notification settings', async () => {
const response = await axios.post(
GRAPHQL_API_URL,
Expand Down Expand Up @@ -116,6 +117,45 @@ describe('Device GraphQL API', () => {
expect(data.notificationSettings.voteTOP100Pushs).toBeTruthy();
expect(data.notificationSettings.outcomePushs).toBeTruthy();
});

it('is not allowed to update notification settings without device hash', async () => {
const response = await axios.post(
GRAPHQL_API_URL,
{
query: `
mutation UpdateNotificationSettings($enabled: Boolean!, $conferenceWeekPushs: Boolean!, $voteConferenceWeekPushs: Boolean!, $voteTOP100Pushs: Boolean!, $outcomePushs: Boolean!) {
updateNotificationSettings(enabled: $enabled, conferenceWeekPushs: $conferenceWeekPushs, voteConferenceWeekPushs: $voteConferenceWeekPushs, voteTOP100Pushs: $voteTOP100Pushs, outcomePushs: $outcomePushs) {
enabled
conferenceWeekPushs
voteConferenceWeekPushs
voteTOP100Pushs
outcomePushs
}
}
`,
variables: {
enabled: true,
conferenceWeekPushs: true,
voteConferenceWeekPushs: true,
voteTOP100Pushs: true,
outcomePushs: true,
},
},
{
headers: {
'Content-Type': 'application/json',
},
},
);

const error = response.data.errors.find((e) => e.path.includes('updateNotificationSettings'));
if (error) {
expect(error.message).toBe('Not Authorised!');
expect(response.data.notificationSettings).toBeUndefined();
} else {
expect(true).toBeFalsy();
}
});
});

describe('verify device', () => {
Expand Down

0 comments on commit f344142

Please sign in to comment.