Skip to content

Commit ad76efa

Browse files
Fix failing tests
1 parent a7b09f3 commit ad76efa

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

frontend/src/app/services/problem.service.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ describe("ProblemService", () => {
6060
}
6161
},
6262
index: 1,
63-
totalProblems: 1,
64-
firstProblemId: 123,
65-
lastProblemId: 789,
66-
nextProblemId: null,
67-
previousProblemId: null,
63+
total: 1,
64+
first: 123,
65+
last: 789,
66+
next: null,
67+
previous: null,
6868
error: null
6969
};
7070

@@ -79,7 +79,7 @@ describe("ProblemService", () => {
7979
done();
8080
});
8181

82-
const req = httpMock.expectOne(`/api/problem/${mockProblemId}?text=&dataset=&gold=&entailmentLabel=`);
82+
const req = httpMock.expectOne(`/api/problem/${mockProblemId}/?text=&dataset=&gold=&entailmentLabel=`);
8383
expect(req.request.method).toBe("GET");
8484
req.flush(mockResponse);
8585
});
@@ -128,7 +128,7 @@ describe("ProblemService", () => {
128128

129129

130130
describe("saveProblem$", () => {
131-
it("should POST the problem and return the response", (done) => {
131+
it("should PATCH the problem and return the response", (done) => {
132132
const problemToSave: ParseInput = {
133133
id: 1,
134134
premises: ["a"],
@@ -144,8 +144,8 @@ describe("ProblemService", () => {
144144

145145
service.submit$.next(problemToSave);
146146

147-
const req = httpMock.expectOne("/api/problem/1");
148-
expect(req.request.method).toBe("POST");
147+
const req = httpMock.expectOne("/api/problem/1/");
148+
expect(req.request.method).toBe("PATCH");
149149
expect(req.request.body).toEqual(problemToSave);
150150
req.flush(mockResponse);
151151
});
@@ -166,7 +166,7 @@ describe("ProblemService", () => {
166166

167167
service.submit$.next(problemToSave);
168168

169-
const req = httpMock.expectOne("/api/problem/2");
169+
const req = httpMock.expectOne("/api/problem/2/");
170170
req.flush("Error", { status: 500, statusText: "Server Error" });
171171
});
172172
});
@@ -180,7 +180,7 @@ describe("ProblemService", () => {
180180
done();
181181
});
182182

183-
const req = httpMock.expectOne("/api/problem/");
183+
const req = httpMock.expectOne("/api/problem/first/");
184184
expect(req.request.method).toBe("GET");
185185
req.flush(mockResponse);
186186
});
@@ -191,7 +191,7 @@ describe("ProblemService", () => {
191191
done();
192192
});
193193

194-
const req = httpMock.expectOne("/api/problem/");
194+
const req = httpMock.expectOne("/api/problem/first/");
195195
req.flush("Error", { status: 500, statusText: "Server Error" });
196196
});
197197
});

0 commit comments

Comments
 (0)