@@ -24,81 +24,81 @@ describe('permissionHelpers', () => {
2424 canManageCourseUpdates : {
2525 action : COURSE_PERMISSIONS . MANAGE_COURSE_UPDATES ,
2626 scope : courseId ,
27- } ,
27+ } ,
2828 } ) ;
2929 } ) ;
3030
31- describe ( 'getFilesPermissions' , ( ) => {
32- it ( 'should return correct permission structure for file operations' , ( ) => {
33- const result = getFilesPermissions ( mockCourseId ) ;
34-
35- expect ( result ) . toEqual ( {
36- canViewFiles : {
37- action : COURSE_PERMISSIONS . VIEW_FILES ,
38- scope : mockCourseId ,
39- } ,
40- canCreateFiles : {
41- action : COURSE_PERMISSIONS . CREATE_FILES ,
42- scope : mockCourseId ,
43- } ,
44- canDeleteFiles : {
45- action : COURSE_PERMISSIONS . DELETE_FILES ,
46- scope : mockCourseId ,
47- } ,
48- canEditFiles : {
49- action : COURSE_PERMISSIONS . EDIT_FILES ,
50- scope : mockCourseId ,
51- } ,
31+ describe ( 'getFilesPermissions' , ( ) => {
32+ it ( 'should return correct permission structure for file operations' , ( ) => {
33+ const result = getFilesPermissions ( mockCourseId ) ;
34+
35+ expect ( result ) . toEqual ( {
36+ canViewFiles : {
37+ action : COURSE_PERMISSIONS . VIEW_FILES ,
38+ scope : mockCourseId ,
39+ } ,
40+ canCreateFiles : {
41+ action : COURSE_PERMISSIONS . CREATE_FILES ,
42+ scope : mockCourseId ,
43+ } ,
44+ canDeleteFiles : {
45+ action : COURSE_PERMISSIONS . DELETE_FILES ,
46+ scope : mockCourseId ,
47+ } ,
48+ canEditFiles : {
49+ action : COURSE_PERMISSIONS . EDIT_FILES ,
50+ scope : mockCourseId ,
51+ } ,
52+ } ) ;
5253 } ) ;
53- } ) ;
5454
55- it ( 'should use the provided courseId as scope for all permissions' , ( ) => {
56- const customCourseId = 'course-v1:TestOrg+TestCourse+2024' ;
57- const result = getFilesPermissions ( customCourseId ) ;
55+ it ( 'should use the provided courseId as scope for all permissions' , ( ) => {
56+ const customCourseId = 'course-v1:TestOrg+TestCourse+2024' ;
57+ const result = getFilesPermissions ( customCourseId ) ;
5858
59- Object . values ( result ) . forEach ( permission => {
60- expect ( permission . scope ) . toBe ( customCourseId ) ;
59+ Object . values ( result ) . forEach ( permission => {
60+ expect ( permission . scope ) . toBe ( customCourseId ) ;
61+ } ) ;
6162 } ) ;
6263 } ) ;
63- } ) ;
6464
65- describe ( 'getGradingPermissions' , ( ) => {
66- it ( 'returns VIEW and EDIT permissions with the correct actions and scope' , ( ) => {
67- const result = getGradingPermissions ( courseId ) ;
65+ describe ( 'getGradingPermissions' , ( ) => {
66+ it ( 'returns VIEW and EDIT permissions with the correct actions and scope' , ( ) => {
67+ const result = getGradingPermissions ( courseId ) ;
6868
69- expect ( result . canViewGradingSettings . action ) . toBe ( COURSE_PERMISSIONS . VIEW_GRADING_SETTINGS ) ;
70- expect ( result . canViewGradingSettings . scope ) . toBe ( courseId ) ;
71- expect ( result . canEditGradingSettings . action ) . toBe ( COURSE_PERMISSIONS . EDIT_GRADING_SETTINGS ) ;
72- expect ( result . canEditGradingSettings . scope ) . toBe ( courseId ) ;
69+ expect ( result . canViewGradingSettings . action ) . toBe ( COURSE_PERMISSIONS . VIEW_GRADING_SETTINGS ) ;
70+ expect ( result . canViewGradingSettings . scope ) . toBe ( courseId ) ;
71+ expect ( result . canEditGradingSettings . action ) . toBe ( COURSE_PERMISSIONS . EDIT_GRADING_SETTINGS ) ;
72+ expect ( result . canEditGradingSettings . scope ) . toBe ( courseId ) ;
73+ } ) ;
7374 } ) ;
74- } ) ;
7575
76- describe ( 'getPagesAndResourcesPermissions' , ( ) => {
77- it ( 'returns VIEW and MANAGE permissions with the correct actions and scope' , ( ) => {
78- const result = getPagesAndResourcesPermissions ( courseId ) ;
76+ describe ( 'getPagesAndResourcesPermissions' , ( ) => {
77+ it ( 'returns VIEW and MANAGE permissions with the correct actions and scope' , ( ) => {
78+ const result = getPagesAndResourcesPermissions ( courseId ) ;
7979
80- expect ( result . canViewPagesAndResources . action ) . toBe ( COURSE_PERMISSIONS . VIEW_PAGES_AND_RESOURCES ) ;
81- expect ( result . canViewPagesAndResources . scope ) . toBe ( courseId ) ;
82- expect ( result . canManagePagesAndResources . action ) . toBe ( COURSE_PERMISSIONS . MANAGE_PAGES_AND_RESOURCES ) ;
83- expect ( result . canManagePagesAndResources . scope ) . toBe ( courseId ) ;
80+ expect ( result . canViewPagesAndResources . action ) . toBe ( COURSE_PERMISSIONS . VIEW_PAGES_AND_RESOURCES ) ;
81+ expect ( result . canViewPagesAndResources . scope ) . toBe ( courseId ) ;
82+ expect ( result . canManagePagesAndResources . action ) . toBe ( COURSE_PERMISSIONS . MANAGE_PAGES_AND_RESOURCES ) ;
83+ expect ( result . canManagePagesAndResources . scope ) . toBe ( courseId ) ;
84+ } ) ;
8485 } ) ;
85- } ) ;
8686
87- describe ( 'getAdvancedSettingsPermissions' , ( ) => {
88- it ( 'returns MANAGE permission with the correct action and scope' , ( ) => {
89- const result = getAdvancedSettingsPermissions ( courseId ) ;
87+ describe ( 'getAdvancedSettingsPermissions' , ( ) => {
88+ it ( 'returns MANAGE permission with the correct action and scope' , ( ) => {
89+ const result = getAdvancedSettingsPermissions ( courseId ) ;
9090
91- expect ( result . canManageAdvancedSettings . action ) . toBe ( COURSE_PERMISSIONS . MANAGE_ADVANCED_SETTINGS ) ;
92- expect ( result . canManageAdvancedSettings . scope ) . toBe ( courseId ) ;
93- } ) ;
91+ expect ( result . canManageAdvancedSettings . action ) . toBe ( COURSE_PERMISSIONS . MANAGE_ADVANCED_SETTINGS ) ;
92+ expect ( result . canManageAdvancedSettings . scope ) . toBe ( courseId ) ;
93+ } ) ;
9494
95- it ( 'uses the provided courseId as scope' , ( ) => {
96- const otherId = 'course-v1:another+test+run' ;
97- const result = getAdvancedSettingsPermissions ( otherId ) ;
95+ it ( 'uses the provided courseId as scope' , ( ) => {
96+ const otherId = 'course-v1:another+test+run' ;
97+ const result = getAdvancedSettingsPermissions ( otherId ) ;
9898
99- expect ( result . canManageAdvancedSettings . scope ) . toBe ( otherId ) ;
100- } ) ;
101- } ) ;
99+ expect ( result . canManageAdvancedSettings . scope ) . toBe ( otherId ) ;
100+ } ) ;
101+ } ) ;
102102
103103 it ( 'should use correct COURSE_PERMISSIONS constants for each action' , ( ) => {
104104 const result = getFilesPermissions ( mockCourseId ) ;
0 commit comments