-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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({ | ||
|
@@ -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'; | ||
|
||
|