Skip to content

Commit ea81662

Browse files
committed
fixed update testcase
1 parent 1856493 commit ea81662

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/routes/tutorial.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ describe("checking tutorial functions", () => {
4545
expect(response.body.res).toMatch(/added tutorial/);
4646
});
4747

48+
let tutorialId;
4849
beforeEach(async () => {
49-
agent.post("/tutorial/add").send({
50+
const id = agent.post("/tutorial/add").send({
5051
no: "123",
5152
title: "abc",
5253
hours: "3",
5354
cognitiveLevel: ["L1", "L2"],
5455
});
56+
tutorialId = JSON.parse(id.res.text).id;
5557
});
5658

5759
afterEach(async () => {
@@ -68,7 +70,7 @@ describe("checking tutorial functions", () => {
6870

6971
it("update tutorial", async () => {
7072
const response = await agent
71-
.post("/tutorial/update")
73+
.post(`/tutorial/update+${tutorialId}`)
7274
.send({ no: "123" }, { no: "123" });
7375
expect(response.headers["content-type"]).toMatch(/json/);
7476
expect(response.status).toBe(200);

0 commit comments

Comments
 (0)