Skip to content

Commit 7fe0981

Browse files
committed
fix: test error of recent-course-packs
1 parent b240015 commit 7fe0981

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/api/src/user-course-progress/tests/user-course-progress.e2e-spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ describe("user-progress e2e", () => {
4343
const courseIdFirst = createId();
4444
const coursePackIdSecond = createId();
4545
const courseIdSecond = createId();
46-
await insertUserCourseProgress(db, coursePackIdFirst, courseIdFirst, 0);
47-
await insertUserCourseProgress(db, coursePackIdSecond, courseIdSecond, 10);
46+
const userId = createId();
47+
await insertUserCourseProgress(db, coursePackIdFirst, courseIdFirst, 0, userId);
48+
await insertUserCourseProgress(db, coursePackIdSecond, courseIdSecond, 10, userId);
4849

4950
await request(app.getHttpServer())
5051
.get("/user-course-progress/recent-course-packs")
5152
.set("Authorization", `Bearer ${token}`)
53+
.query({ userId })
5254
.expect(200)
5355
.expect(({ body }) => {
5456
expect(body.length).toBe(2);

apps/api/test/fixture/db.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ export async function insertUserCourseProgress(
7878
coursePackId: string,
7979
courseId: string,
8080
statementIndex: number,
81+
userId?: string,
8182
) {
8283
const [entity] = await db
8384
.insert(userCourseProgress)
8485
.values({
85-
userId: getTokenOwner(),
86+
userId: userId || getTokenOwner(),
8687
coursePackId,
8788
courseId,
8889
statementIndex,

0 commit comments

Comments
 (0)