Skip to content

Commit

Permalink
test: 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Conut-1 committed Nov 22, 2024
1 parent 7b0788b commit 5b99546
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nestjs-BE/server/test/spaces.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ describe('SpacesController (e2e)', () => {
expect(res.body.statusCode).toBe(HttpStatus.OK);
expect(res.body.data.uuid).toBe(testSpace.uuid);
expect(res.body.data.name).toBe(newSpace.name);
expect(res.body.data.icon).not.toBe(
configService.get<string>('APP_ICON_URL'),
);
expect(res.body.data.icon).toMatch(imageRegExp);
});
});
Expand Down Expand Up @@ -381,6 +384,26 @@ describe('SpacesController (e2e)', () => {
.expect({ message: 'Bad Request', statusCode: HttpStatus.BAD_REQUEST });
});

it('/spaces/:space_uuid?profile_uuid={profile_uuid} (PATCH) icon is string', async () => {
const newSpace = {
name: 'new test space',
icon: 'string value',
};
await prisma.profileSpace.create({
data: { spaceUuid: testSpace.uuid, profileUuid: testProfile.uuid },
});

return request(app.getHttpServer())
.patch(`/spaces/${testSpace.uuid}?profile_uuid=${testProfile.uuid}`)
.auth(testToken, { type: 'bearer' })
.send({ name: newSpace.name, icon: newSpace.icon })
.expect(HttpStatus.BAD_REQUEST)
.expect((res) => {
expect(res.body.message).toBe('icon is string');
expect(res.body.statusCode).toBe(HttpStatus.BAD_REQUEST);
});
});

it('/spaces/:space_uuid?profile_uuid={profile_uuid} (PATCH) unauthorized', async () => {
const icon = await readFile(resolve(__dirname, './base_image.png'));
const newSpace = { name: 'new test space', icon };
Expand Down

0 comments on commit 5b99546

Please sign in to comment.