Skip to content

Commit ca2a42f

Browse files
committed
update test
1 parent 60d4029 commit ca2a42f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

static/app/views/issueDetails/utils.spec.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,37 @@ describe('useHasStreamlinedUI', () => {
6767
expect(prefersStreamlineButQueryParamDisabled.current).toBe(false);
6868
});
6969

70-
it('ignores preferences if enforce flag is set', () => {
70+
it('ignores preferences if enforce flag is set and user has not opted out', () => {
7171
const enforceOrg = OrganizationFixture({
7272
features: ['issue-details-streamline-enforce'],
7373
});
7474
jest.mocked(useOrganization).mockReturnValue(enforceOrg);
7575

7676
ConfigStore.init();
7777
const user = UserFixture();
78-
user.options.prefersIssueDetailsStreamlinedUI = false;
7978
act(() => ConfigStore.set('user', user));
8079

8180
jest.mocked(useLocation).mockReturnValue(LocationFixture());
8281
const {result} = renderHook(useHasStreamlinedUI);
8382
expect(result.current).toBe(true);
8483
});
8584

85+
it('respects preferences if enforce flag is set and user has opted out', () => {
86+
const enforceOrg = OrganizationFixture({
87+
features: ['issue-details-streamline-enforce'],
88+
});
89+
jest.mocked(useOrganization).mockReturnValue(enforceOrg);
90+
91+
ConfigStore.init();
92+
const user = UserFixture();
93+
user.options.prefersIssueDetailsStreamlinedUI = false;
94+
act(() => ConfigStore.set('user', user));
95+
96+
jest.mocked(useLocation).mockReturnValue(LocationFixture());
97+
const {result} = renderHook(useHasStreamlinedUI);
98+
expect(result.current).toBe(false);
99+
});
100+
86101
it('ignores preferences if organization option is set to true', () => {
87102
jest.mocked(useLocation).mockReturnValue(LocationFixture());
88103

0 commit comments

Comments
 (0)