Skip to content

Commit

Permalink
test: 10번 문제 채점 테스트 케이스 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
flydog98 authored and LuizyHub committed Dec 1, 2023
1 parent c9da234 commit b1ec48a
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions packages/backend/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,75 @@ describe('QuizWizardController (e2e)', () => {
});
});

describe('10번 문제 채점 테스트', () => {
const id = 10;
afterEach(async () => {
await request(app.getHttpServer())
.delete(`/api/v1/quizzes/${id}/command`)
.set('Cookie', cookie);
});

it('베스트 성공 케이스', async () => {
response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/command`)
.send({
mode: 'command',
message: 'git clean -f tmp.js',
});

cookie = response.headers['set-cookie'][0].split(';')[0];

response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/command`)
.set('Cookie', cookie)
.send({
mode: 'command',
message: 'git clean -f tmptmp.js',
});

response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/command`)
.set('Cookie', cookie)
.send({
mode: 'command',
message: 'git clean -f tmptmptmp.js',
});

response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/submit`)
.set('Cookie', cookie)
.expect(200);

expect(response.body).toHaveProperty('solved', true);
});

it('tmptmptmp.js는 안 지움', async () => {
response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/command`)
.send({
mode: 'command',
message: 'git clean -f tmp.js',
});

cookie = response.headers['set-cookie'][0].split(';')[0];

response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/command`)
.set('Cookie', cookie)
.send({
mode: 'command',
message: 'git clean -f tmptmp.js',
});

response = await request(app.getHttpServer())
.post(`/api/v1/quizzes/${id}/submit`)
.set('Cookie', cookie)
.expect(200);

expect(response.body).toHaveProperty('solved', false);
});
});

afterAll(async () => {
await app.close();
});
Expand Down

0 comments on commit b1ec48a

Please sign in to comment.