@@ -24,6 +24,7 @@ import { CourseSetting, DBCourseSetting, GlobalSetting, ParseableDBCourseSetting
2424
2525import { cleanIDs , loadCSV } from '../utils' ;
2626import { humanReadableTimeDuration } from 'src/common/models/parsers' ;
27+ import { SessionInfo } from 'src/common/models/session' ;
2728
2829describe ( 'Test the settings store' , ( ) => {
2930
@@ -49,8 +50,14 @@ describe('Test the settings store', () => {
4950 . map ( setting => ( {
5051 setting_name : setting . setting_name as string , value : setting . setting_value as SettingValueType
5152 } ) ) ;
52- // Login to the course as the admin in order to be authenticated for the rest of the test.
53- await api . post ( 'login' , { username : 'admin' , password : 'admin' } ) ;
53+ // Login to the course as an instructor of Arithmetic. (course_id: 4)
54+ const response = await api . post ( 'login' , { username : 'lisa' , password : 'lisa' } ) ;
55+
56+ // set the session course to the Arithmetic course (course_id: 4)
57+ const session_store = useSessionStore ( ) ;
58+ session_store . updateSessionInfo ( response . data as SessionInfo ) ;
59+ await session_store . fetchUserCourses ( ) ;
60+ session_store . setCourse ( 4 ) ;
5461
5562 const settings_store = useSettingsStore ( ) ;
5663 await settings_store . fetchGlobalSettings ( ) ;
@@ -92,10 +99,6 @@ describe('Test the settings store', () => {
9299 . filter ( setting => arith_setting_ids . includes ( setting . setting_id ) )
93100 . map ( setting => ( { setting_name : setting . setting_name , value : setting . value } ) ) ;
94101 expect ( arith_settings_from_db ) . toStrictEqual ( arith_settings ) ;
95-
96- // set the session course to this course
97- const session_store = useSessionStore ( ) ;
98- session_store . setCourse ( { course_id : 4 , course_name : 'Arithmetic' } ) ;
99102 } ) ;
100103
101104 test ( 'Get a single course setting based on name' , ( ) => {
0 commit comments