Skip to content

Commit

Permalink
Test src/updateUserRoleInOrganization.ts (PalisadoesFoundation#2111)
Browse files Browse the repository at this point in the history
Co-authored-by: Manik2708 <Manik2708>
  • Loading branch information
Manik2708 authored Mar 30, 2024
1 parent 5dd6663 commit e5f7a9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/resolvers/Mutation/updateUserRoleInOrganization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "vitest";
import {
ADMIN_CANNOT_CHANGE_ITS_ROLE,
ADMIN_CHANGING_ROLE_OF_CREATOR,
ORGANIZATION_NOT_FOUND_ERROR,
USER_NOT_AUTHORIZED_ADMIN,
USER_NOT_AUTHORIZED_ERROR,
Expand Down Expand Up @@ -413,7 +414,7 @@ describe("resolvers -> Mutation -> updateUserRoleInOrganization", () => {
role: "USER",
};
const context = {
userId: testUserSuperAdmin?._id,
userId: testAdminUser?._id.toString(),
};

const {
Expand All @@ -422,6 +423,7 @@ describe("resolvers -> Mutation -> updateUserRoleInOrganization", () => {
"../../../src/resolvers/Mutation/updateUserRoleInOrganization"
);
await updateUserRoleInOrganizationResolver?.({}, args, context);
expect.fail();
} catch (error: unknown) {
expect((error as Error).message).toEqual(
ADMIN_CANNOT_CHANGE_ITS_ROLE.MESSAGE,
Expand Down Expand Up @@ -451,7 +453,7 @@ describe("resolvers -> Mutation -> updateUserRoleInOrganization", () => {
await updateUserRoleInOrganizationResolver?.({}, args, context);
} catch (error: unknown) {
expect((error as Error).message).toEqual(
"Error: Current user must be an ADMIN or a SUPERADMIN",
ADMIN_CHANGING_ROLE_OF_CREATOR.MESSAGE,
);
}
});
Expand Down

0 comments on commit e5f7a9d

Please sign in to comment.