Skip to content

Commit

Permalink
patched tests
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Jul 4, 2024
1 parent dd91e6a commit 1f37161
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/presentation/http/router/join.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test, expect } from 'vitest';

describe('Join API', () => {
describe('POST /join/:hash', () => {
test('Returns 406 when user is already in the team', async () => {
test('Returns 200 and teamMember when user is already in the team', async () => {
const invitationHash = 'Hzh2hy4igf';

/**
Expand Down Expand Up @@ -45,7 +45,15 @@ describe('Join API', () => {
url: `/join/${invitationHash}`,
});

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

expect(response?.json()).toMatchObject({

Check failure on line 50 in src/presentation/http/router/join.test.ts

View workflow job for this annotation

GitHub Actions / tests (implement-public-team-member)

src/presentation/http/router/join.test.ts > Join API > POST /join/:hash > Returns 200 and teamMember when user is already in the team

AssertionError: expected { noteId: 'W2eFQJtlEz', …(2) } to match object { result: { userId: 1, …(2) } } - Expected + Received Object { - "result": Object { "noteId": "W2eFQJtlEz", - "role": 0, + "role": 1, "userId": 1, - }, } ❯ src/presentation/http/router/join.test.ts:50:32
result: {
userId: user.id,
noteId: note.publicId,
role: 0,
},
});

expect(response?.json()).toStrictEqual({
message: 'User already in team',
Expand Down

0 comments on commit 1f37161

Please sign in to comment.