Skip to content

Commit 49fadb4

Browse files
Fix frontend tests as well
1 parent 5acbcb0 commit 49fadb4

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

frontend/src/app/menu/user-menu/user-menu.component.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const fakeUserResponse: UserResponse = {
2121
lastName: "Baggins",
2222
isStaff: false,
2323
role: UserRole.VISITOR,
24-
canEditOrAddProblem: false,
24+
canCreateProblem: false,
25+
canEditProblem: false,
2526
};
2627

2728
const fakeAdminResponse: UserResponse = {
@@ -31,8 +32,9 @@ const fakeAdminResponse: UserResponse = {
3132
firstName: "Gandalf",
3233
lastName: "The Grey",
3334
isStaff: true,
34-
role: UserRole.ANNOTATOR,
35-
canEditOrAddProblem: true,
35+
role: UserRole.MASTER_ANNOTATOR,
36+
canCreateProblem: true,
37+
canEditProblem: true,
3638
};
3739

3840
describe("UserMenuComponent", () => {

frontend/src/app/user/user-settings/user-settings.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const fakeUser: User = {
2424
username: "frodo",
2525
isStaff: false,
2626
role: UserRole.VISITOR,
27-
canEditOrAddProblem: false,
27+
canCreateProblem: false,
28+
canEditProblem: false,
2829
};
2930

3031
@Injectable({ providedIn: "root" })

frontend/src/app/user/utils.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ describe("User utils", () => {
4040
lastName: "User",
4141
isStaff: true,
4242
role: "visitor",
43-
canEditOrAddProblem: false,
43+
canCreateProblem: false,
44+
canEditProblem: false,
4445
};
4546
const user = parseUserData(result);
4647
expect(user).toBeInstanceOf(User);
@@ -51,7 +52,8 @@ describe("User utils", () => {
5152
expect(user?.lastName).toBe("User");
5253
expect(user?.isStaff).toBe(true);
5354
expect(user?.role).toBe(UserRole.VISITOR);
54-
expect(user?.canEditOrAddProblem).toBe(false);
55+
expect(user?.canEditProblem).toBe(false);
56+
expect(user?.canCreateProblem).toBe(false);
5557
});
5658
});
5759

0 commit comments

Comments
 (0)