@@ -67,22 +67,37 @@ describe('useHasStreamlinedUI', () => {
67
67
expect ( prefersStreamlineButQueryParamDisabled . current ) . toBe ( false ) ;
68
68
} ) ;
69
69
70
- it ( 'ignores preferences if enforce flag is set' , ( ) => {
70
+ it ( 'ignores preferences if enforce flag is set and user has not opted out ' , ( ) => {
71
71
const enforceOrg = OrganizationFixture ( {
72
72
features : [ 'issue-details-streamline-enforce' ] ,
73
73
} ) ;
74
74
jest . mocked ( useOrganization ) . mockReturnValue ( enforceOrg ) ;
75
75
76
76
ConfigStore . init ( ) ;
77
77
const user = UserFixture ( ) ;
78
- user . options . prefersIssueDetailsStreamlinedUI = false ;
79
78
act ( ( ) => ConfigStore . set ( 'user' , user ) ) ;
80
79
81
80
jest . mocked ( useLocation ) . mockReturnValue ( LocationFixture ( ) ) ;
82
81
const { result} = renderHook ( useHasStreamlinedUI ) ;
83
82
expect ( result . current ) . toBe ( true ) ;
84
83
} ) ;
85
84
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
+
86
101
it ( 'ignores preferences if organization option is set to true' , ( ) => {
87
102
jest . mocked ( useLocation ) . mockReturnValue ( LocationFixture ( ) ) ;
88
103
0 commit comments