-
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.
Merge pull request #165 from codex-team/feat/return-team-with-note-se…
…ttings Feat: return team with note settings
- Loading branch information
Showing
8 changed files
with
100 additions
and
19 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
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
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,14 +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': 54, | ||
'invitationHash': 'FfAwyaR80C', | ||
'isPublic': true, | ||
'id': 3, | ||
'noteId': 3, | ||
'invitationHash': 'E2zRXv3cp-', | ||
'noteId': 54, | ||
'team': [], | ||
}; | ||
|
||
const response = await global.api?.fakeRequest({ | ||
|
@@ -26,6 +27,30 @@ 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 response = await global.api?.fakeRequest({ | ||
method: 'GET', | ||
url: `/note-settings/${existingNotePublicId}`, | ||
}); | ||
|
||
expect(response?.statusCode).toBe(200); | ||
|
||
expect(response?.json().team).toStrictEqual([ | ||
{ | ||
'id': 2, | ||
'role': 0, | ||
'user': { | ||
'email': '[email protected]', | ||
'id': 1, | ||
'name': 'Test user 1', | ||
'photo': null, | ||
}, | ||
}, | ||
]); | ||
}); | ||
|
||
test('Returns 404 when note settings with specified note public id do not exist', async () => { | ||
const nonexistentId = 'ishvm5qH84'; | ||
|
||
|
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
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
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
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
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