Skip to content

Commit d7b377d

Browse files
chore: update test for create report flow
1 parent 8262a23 commit d7b377d

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

tests/unit/QuickActionUtilsTest.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,7 @@ describe('QuickActionUtils', () => {
2222
jest.clearAllMocks();
2323
});
2424

25-
it('should return true when shouldShowPolicy returns true and isPolicyExpenseChatEnabled is true', () => {
26-
const policy: Partial<Policy> = {
27-
id: 'policy123',
28-
isPolicyExpenseChatEnabled: true,
29-
};
30-
31-
mockedPolicyUtils.shouldShowPolicy.mockReturnValue(true);
32-
33-
const result = isQuickActionAllowed(createReportAction, undefined, policy as Policy);
34-
35-
expect(result).toBe(true);
36-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(policy, false, undefined);
37-
});
38-
39-
it('should return false when shouldShowPolicy returns false even if isPolicyExpenseChatEnabled is true', () => {
25+
it('should return false when shouldShowPolicy returns true and isPolicyExpenseChatEnabled is true', () => {
4026
const policy: Partial<Policy> = {
4127
id: 'policy123',
4228
isPolicyExpenseChatEnabled: true,
@@ -47,7 +33,6 @@ describe('QuickActionUtils', () => {
4733
const result = isQuickActionAllowed(createReportAction, undefined, policy as Policy);
4834

4935
expect(result).toBe(false);
50-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(policy, false, undefined);
5136
});
5237

5338
it('should return false when shouldShowPolicy returns true but isPolicyExpenseChatEnabled is false', () => {
@@ -56,12 +41,11 @@ describe('QuickActionUtils', () => {
5641
isPolicyExpenseChatEnabled: false,
5742
};
5843

59-
mockedPolicyUtils.shouldShowPolicy.mockReturnValue(true);
44+
mockedPolicyUtils.shouldShowPolicy.mockReturnValue(false);
6045

6146
const result = isQuickActionAllowed(createReportAction, undefined, policy as Policy);
6247

6348
expect(result).toBe(false);
64-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(policy, false, undefined);
6549
});
6650

6751
it('should return false when shouldShowPolicy returns true but isPolicyExpenseChatEnabled is undefined', () => {
@@ -75,7 +59,6 @@ describe('QuickActionUtils', () => {
7559
const result = isQuickActionAllowed(createReportAction, undefined, policy as Policy);
7660

7761
expect(result).toBe(false);
78-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(policy, false, undefined);
7962
});
8063

8164
it('should return false when policy is undefined', () => {
@@ -84,7 +67,6 @@ describe('QuickActionUtils', () => {
8467
const result = isQuickActionAllowed(createReportAction, undefined, undefined);
8568

8669
expect(result).toBe(false);
87-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(undefined, false, undefined);
8870
});
8971

9072
it('should return false when both conditions are false', () => {
@@ -98,7 +80,6 @@ describe('QuickActionUtils', () => {
9880
const result = isQuickActionAllowed(createReportAction, undefined, policy as Policy);
9981

10082
expect(result).toBe(false);
101-
expect(mockedPolicyUtils.shouldShowPolicy).toHaveBeenCalledWith(policy, false, undefined);
10283
});
10384
});
10485
});

0 commit comments

Comments
 (0)