@@ -12,6 +12,7 @@ import { Context as ResponsiveContext } from 'react-responsive';
12
12
import { MemoryRouter } from 'react-router-dom' ;
13
13
14
14
import StudioHeader from './StudioHeader' ;
15
+ import messages from './messages' ;
15
16
16
17
const authenticatedUser = {
17
18
userId : 3 ,
@@ -114,6 +115,16 @@ describe('Header', () => {
114
115
expect ( dropdownOption ) . toBeVisible ( ) ;
115
116
} ) ;
116
117
118
+ it ( 'maintenance should not be in user menu' , async ( ) => {
119
+ currentUser = { ...authenticatedUser , administrator : false } ;
120
+ const { getAllByRole, queryByText } = render ( < RootWrapper { ...props } /> ) ;
121
+ const userMenu = getAllByRole ( 'button' ) [ 1 ] ;
122
+ await waitFor ( ( ) => fireEvent . click ( userMenu ) ) ;
123
+ const maintenanceButton = queryByText ( messages [ 'header.user.menu.maintenance' ] . defaultMessage ) ;
124
+
125
+ expect ( maintenanceButton ) . toBeNull ( ) ;
126
+ } ) ;
127
+
117
128
it ( 'user menu should use avatar icon' , async ( ) => {
118
129
currentUser = { ...authenticatedUser , avatar : null } ;
119
130
const { getByTestId } = render ( < RootWrapper { ...props } /> ) ;
@@ -175,6 +186,15 @@ describe('Header', () => {
175
186
expect ( desktopMenu ) . toBeNull ( ) ;
176
187
} ) ;
177
188
189
+ it ( 'maintenance should be in user menu' , async ( ) => {
190
+ const { getAllByRole, getByText } = render ( < RootWrapper { ...props } /> ) ;
191
+ const userMenu = getAllByRole ( 'button' ) [ 1 ] ;
192
+ await waitFor ( ( ) => fireEvent . click ( userMenu ) ) ;
193
+ const maintenanceButton = getByText ( messages [ 'header.user.menu.maintenance' ] . defaultMessage ) ;
194
+
195
+ expect ( maintenanceButton ) . toBeVisible ( ) ;
196
+ } ) ;
197
+
178
198
it ( 'user menu should use avatar image' , async ( ) => {
179
199
const { getByTestId } = render ( < RootWrapper { ...props } /> ) ;
180
200
const avatarImage = getByTestId ( 'avatar-image' ) ;
0 commit comments