Skip to content

Commit

Permalink
Added test to noteSettings.test
Browse files Browse the repository at this point in the history
  • Loading branch information
kloV148 committed Feb 1, 2024
1 parent 7818a32 commit 55e9e11
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions src/presentation/http/router/noteSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,15 @@ import noteSettings from '@tests/test-data/notes-settings.json';
describe('NoteSettings API', () => {
describe('GET /note-settings/:notePublicId ', () => {
test('Returns note settings by public id with 200 status', async () => {
const existingNotePublicId = 'Pq1T9vc23Q';
const existingNotePublicId = 'f43NU75weU';

const expectedNoteSettings = {
'customHostname': 'codex.so',
'id': 3,
'invitationHash': 'E2zRXv3cp-',
'id': 54,
'invitationHash': 'FfAwyaR80C',
'isPublic': true,
'noteId': 3,
'team': [
{
'id': 2,
'role': 0,
'user': {
'email': '[email protected]',
'id': 1,
'name': 'Test user 1',
'photo': null,
},
},
],
'noteId': 54,
'team': [],
};

const response = await global.api?.fakeRequest({
Expand All @@ -38,6 +27,32 @@ describe('NoteSettings API', () => {
expect(response?.json()).toStrictEqual(expectedNoteSettings);
});

test('Returns team with note settings by public id with 200 status', async () => {
const existingNotePublicId = 'Pq1T9vc23Q';

const expectedTeam = [
{
'id': 2,
'role': 0,
'user': {
'email': '[email protected]',
'id': 1,
'name': 'Test user 1',
'photo': null,
},
},
];

const response = await global.api?.fakeRequest({
method: 'GET',
url: `/note-settings/${existingNotePublicId}`,
});

expect(response?.statusCode).toBe(200);

expect(response?.json().team).toStrictEqual(expectedTeam);
});

test('Returns 404 when note settings with specified note public id do not exist', async () => {
const nonexistentId = 'ishvm5qH84';

Expand Down

0 comments on commit 55e9e11

Please sign in to comment.