@@ -44,14 +44,15 @@ import { SF_TYPE_REGISTRY } from './core/models/sf-type-registry';
4444import { SFProjectService } from './core/sf-project.service' ;
4545import { NavigationComponent } from './navigation/navigation.component' ;
4646import { GlobalNoticesComponent } from './shared/global-notices/global-notices.component' ;
47- import { SettingsAuthGuard , SyncAuthGuard , UsersAuthGuard } from './shared/project-router.guard' ;
47+ import { NmtDraftAuthGuard , SettingsAuthGuard , SyncAuthGuard , UsersAuthGuard } from './shared/project-router.guard' ;
4848import { paratextUsersFromRoles } from './shared/test-utils' ;
4949
5050const mockedAuthService = mock ( AuthService ) ;
5151const mockedUserService = mock ( UserService ) ;
5252const mockedSettingsAuthGuard = mock ( SettingsAuthGuard ) ;
5353const mockedSyncAuthGuard = mock ( SyncAuthGuard ) ;
5454const mockedUsersAuthGuard = mock ( UsersAuthGuard ) ;
55+ const mockedNmtDraftAuthGuard = mock ( NmtDraftAuthGuard ) ;
5556const mockedSFProjectService = mock ( SFProjectService ) ;
5657const mockedCookieService = mock ( CookieService ) ;
5758const mockedLocationService = mock ( LocationService ) ;
@@ -102,6 +103,7 @@ describe('AppComponent', () => {
102103 { provide : SettingsAuthGuard , useMock : mockedSettingsAuthGuard } ,
103104 { provide : SyncAuthGuard , useMock : mockedSyncAuthGuard } ,
104105 { provide : UsersAuthGuard , useMock : mockedUsersAuthGuard } ,
106+ { provide : NmtDraftAuthGuard , useMock : mockedNmtDraftAuthGuard } ,
105107 { provide : SFProjectService , useMock : mockedSFProjectService } ,
106108 { provide : CookieService , useMock : mockedCookieService } ,
107109 { provide : LocationService , useMock : mockedLocationService } ,
@@ -129,9 +131,20 @@ describe('AppComponent', () => {
129131
130132 expect ( env . isDrawerVisible ) . toEqual ( true ) ;
131133 expect ( env . selectedProjectId ) . toEqual ( 'project01' ) ;
132- // Translate | Overview | Edit & review | Community Checking | Manage questions | Questions & answers |
133- // Synchronize | Users | Settings
134- expect ( env . menuLength ) . toEqual ( 9 ) ;
134+
135+ const expectedMenuItemCount = [
136+ 'Translate' ,
137+ 'Overview' ,
138+ 'Edit & review' ,
139+ 'Generate draft' ,
140+ 'Community Checking' ,
141+ 'My progress' ,
142+ 'Questions & answers' ,
143+ 'Sync with Paratext' ,
144+ 'Users' ,
145+ 'Settings'
146+ ] . length ;
147+ expect ( env . menuLength ) . toEqual ( expectedMenuItemCount ) ;
135148 verify ( mockedUserService . setCurrentProjectId ( anything ( ) , 'project01' ) ) . once ( ) ;
136149 tick ( ) ;
137150 } ) ) ;
@@ -143,8 +156,15 @@ describe('AppComponent', () => {
143156
144157 expect ( env . isDrawerVisible ) . toEqual ( true ) ;
145158 expect ( env . selectedProjectId ) . toEqual ( 'project02' ) ;
146- // Expect: Community Checking | Manage Questions | Overview | Sync | Settings | Users
147- expect ( env . menuLength ) . toEqual ( 6 ) ;
159+ const expectedMenuItemCount : number = [
160+ 'Community Checking' ,
161+ 'My progress' ,
162+ 'Overview' ,
163+ 'Sync with Paratext' ,
164+ 'Settings' ,
165+ 'Users'
166+ ] . length ;
167+ expect ( env . menuLength ) . toEqual ( expectedMenuItemCount ) ;
148168 verify ( mockedUserService . setCurrentProjectId ( anything ( ) , 'project02' ) ) . once ( ) ;
149169 discardPeriodicTasks ( ) ;
150170 } ) ) ;
@@ -700,6 +720,7 @@ class TestEnvironment {
700720 when ( mockedSettingsAuthGuard . allowTransition ( anything ( ) ) ) . thenReturn ( this . canSeeSettings$ ) ;
701721 when ( mockedSyncAuthGuard . allowTransition ( anything ( ) ) ) . thenReturn ( this . canSync$ ) ;
702722 when ( mockedUsersAuthGuard . allowTransition ( anything ( ) ) ) . thenReturn ( this . canSeeUsers$ ) ;
723+ when ( mockedNmtDraftAuthGuard . allowTransition ( anything ( ) ) ) . thenReturn ( this . canSeeGenerateDraft$ ) ;
703724 when ( mockedI18nService . localeCode ) . thenReturn ( 'en' ) ;
704725 when ( mockedUrlService . helps ) . thenReturn ( 'helps' ) ;
705726 when ( mockedUrlService . announcementPage ) . thenReturn ( 'community-announcements' ) ;
0 commit comments