@@ -10,6 +10,7 @@ import { click, setupOSFApplicationTest, visit } from 'ember-osf-web/tests/helpe
1010import NodeModel from 'ember-osf-web/models/node' ;
1111import FileModel from 'ember-osf-web/models/file' ;
1212import FileProviderModel from 'ember-osf-web/models/file-provider' ;
13+ import { Permission } from 'ember-osf-web/models/osf-model' ;
1314
1415interface GuidNodeTestContext extends TestContext {
1516 node : ModelInstance < NodeModel > ;
@@ -31,7 +32,45 @@ module('Acceptance | guid-node/files', hooks => {
3132 } ) ;
3233 } ) ;
3334
35+ test ( 'left-nav: logged out' , async function ( this : GuidNodeTestContext , assert ) {
36+ await visit ( `/${ this . node . id } /files` ) ;
37+ assert . equal ( currentRouteName ( ) , 'guid-node.files.provider' , 'logged out: Current route is files' ) ;
38+ assert . dom ( '[data-test-overview-link]' ) . exists ( 'logged out: Overview link exists' ) ;
39+ assert . dom ( '[data-test-files-link]' ) . exists ( 'logged out: Files link exists' ) ;
40+ assert . dom ( '[data-test-analytics-link]' ) . exists ( 'logged out: Analytics link exists' ) ;
41+ assert . dom ( '[data-test-registrations-link]' ) . exists ( 'logged out: Registrations link exists' ) ;
42+ assert . dom ( '[data-test-contributors-link]' ) . doesNotExist ( 'logged out: Contributors link does not exist' ) ;
43+ assert . dom ( '[data-test-settings-link]' ) . doesNotExist ( 'logged out: Settings link does not exist' ) ;
44+ } ) ;
45+
46+ test ( 'left-nav: VOL' , async function ( this : GuidNodeTestContext , assert ) {
47+ const currentUser = this . owner . lookup ( 'service:current-user' ) ;
48+ currentUser . viewOnlyToken = 'SomeVolToken' ;
49+ await visit ( `/${ this . node . id } /files` ) ;
50+ assert . equal ( currentRouteName ( ) , 'guid-node.files.provider' , 'VOL: Current route is files' ) ;
51+ assert . dom ( '[data-test-overview-link]' ) . exists ( 'VOL: Overview link exists' ) ;
52+ assert . dom ( '[data-test-files-link]' ) . exists ( 'VOL: Files link exists' ) ;
53+ assert . dom ( '[data-test-analytics-link]' ) . exists ( 'VOL: Analytics link exists' ) ;
54+ assert . dom ( '[data-test-registrations-link]' ) . exists ( 'VOL: Registrations link exists' ) ;
55+ assert . dom ( '[data-test-contributors-link]' ) . doesNotExist ( 'VOL: Contributors link does not exist' ) ;
56+ assert . dom ( '[data-test-settings-link]' ) . doesNotExist ( 'VOL: Settings link does not exist' ) ;
57+ } ) ;
58+
59+ test ( 'left-nav: AVOL' , async function ( this : GuidNodeTestContext , assert ) {
60+ const node = await this . owner . lookup ( 'service:store' ) . findRecord ( 'node' , this . node . id ) ;
61+ node . apiMeta = { version : '2' , anonymous : true } ;
62+ await visit ( `/${ this . node . id } /files` ) ;
63+ assert . equal ( currentRouteName ( ) , 'guid-node.files.provider' , 'AVOL: Current route is files' ) ;
64+ assert . dom ( '[data-test-overview-link]' ) . exists ( 'AVOL: Overview link exists' ) ;
65+ assert . dom ( '[data-test-files-link]' ) . exists ( 'AVOL: Files link exists' ) ;
66+ assert . dom ( '[data-test-analytics-link]' ) . exists ( 'AVOL: Analytics link exists' ) ;
67+ assert . dom ( '[data-test-registrations-link]' ) . doesNotExist ( 'AVOL: Registrations link does not exist' ) ;
68+ assert . dom ( '[data-test-contributors-link]' ) . doesNotExist ( 'AVOL: Contributors link does not exist' ) ;
69+ assert . dom ( '[data-test-settings-link]' ) . doesNotExist ( 'AVOL: Settings link does not exist' ) ;
70+ } ) ;
71+
3472 test ( 'read user' , async function ( this : GuidNodeTestContext , assert ) {
73+ this . node . currentUserPermissions = [ Permission . Read ] ;
3574 await visit ( `/${ this . node . id } /files` ) ;
3675
3776 assert . equal ( currentRouteName ( ) , 'guid-node.files.provider' , 'Current route is files' ) ;
0 commit comments