Skip to content

Commit

Permalink
quickFix(tests): logic fixes
Browse files Browse the repository at this point in the history
- noteList test logic fixed (authorization for specific user needed)
  • Loading branch information
e11sy committed Oct 31, 2023
1 parent 29c81a5 commit ea09309
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
10 changes: 5 additions & 5 deletions src/presentation/http/router/noteList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ describe('NoteList API', () => {

const body = response?.body !== undefined ? JSON.parse(response?.body) : {};

expect(body).toHaveLength(portionSize);
expect(body.items).toHaveLength(portionSize);
});

test('Returns noteList with specified lenght (for last page)', async () => {
const expectedStatus = 200;
const portionSize = 20;
const portionSize = 19;
const pageNumber = 2;

const response = await global.api?.fakeRequest({
Expand All @@ -82,7 +82,7 @@ describe('NoteList API', () => {

const body = response?.body !== undefined ? JSON.parse(response?.body) : {};

expect(body).toHaveLength(portionSize);
expect(body.items).toHaveLength(portionSize);
});

test('Returns noteList with no items if it has no notes', async () => {
Expand All @@ -104,8 +104,8 @@ describe('NoteList API', () => {

const body = response?.body !== undefined ? JSON.parse(response?.body) : {};

expect(body).toEqual([]);
expect(body).toHaveLength(0);
expect(body).toEqual( { items : [] } );
expect(body.items).toHaveLength(0);
});

test('Returns 400 when page < 0', async () => {
Expand Down
Loading

0 comments on commit ea09309

Please sign in to comment.