Skip to content

Commit

Permalink
🔧 fix(index.spec.ts): remove unnecessary setting of process.env.APP v…
Browse files Browse the repository at this point in the history
…ariable in test cases
  • Loading branch information
sebpalluel committed Dec 22, 2023
1 parent 5d99f96 commit 92c5129
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions libs/next/next-auth/options/src/lib/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ describe('createOptions callbacks', () => {
});

it('should return correct token with updated role if role is part of user roleAssignments', async () => {
process.env.APP = 'BACKOFFICE';

(getAccount as jest.Mock).mockResolvedValueOnce({ ...mockOrganizer });
const result = await createOptions().callbacks.jwt({
token: { ...mockToken, user: mockOrganizer },
Expand Down Expand Up @@ -188,7 +186,6 @@ describe('createOptions callbacks', () => {
});

it('should return correct token with no role and no access if user update token without role', async () => {
process.env.APP = 'BACKOFFICE';
(getAccount as jest.Mock).mockResolvedValueOnce({
...mockOrganizer,
role: null,
Expand Down Expand Up @@ -222,7 +219,7 @@ describe('createOptions callbacks', () => {
role: Roles_Enum.OrganizerContentManager,
},
};
process.env.APP = 'BACKOFFICE';

const result = await createOptions().callbacks.jwt({
token: mockToken,
user: mockOrganizerNotAuthorized,
Expand All @@ -246,8 +243,6 @@ describe('createOptions callbacks', () => {
});

it("shouldn't return token with role if role is not part of user roleAssignments", async () => {
process.env.APP = 'BACKOFFICE';

(getAccount as jest.Mock).mockResolvedValueOnce(mockOrganizer);
await expect(
createOptions().callbacks.jwt({
Expand Down Expand Up @@ -295,7 +290,6 @@ describe('createOptions callbacks', () => {
(Posthog.getInstance as jest.Mock).mockImplementationOnce(() => ({
getFeatureFlag: jest.fn().mockReturnValue(true),
}));
process.env.APP = 'BACKOFFICE';
(getAccount as jest.Mock).mockResolvedValueOnce(
mockOrganizerWithPendingKyc,
);
Expand All @@ -319,8 +313,6 @@ describe('createOptions callbacks', () => {
});

it("should return token with role even if user don't have kyc if feature flag kycFlag not activated", async () => {
process.env.APP = 'BACKOFFICE';

(getAccount as jest.Mock).mockResolvedValueOnce(
mockOrganizerWithPendingKyc,
);
Expand Down

0 comments on commit 92c5129

Please sign in to comment.