@@ -115,10 +115,10 @@ describe('sessions', () => {
115115 it ( 'should accept the creation of a host session if there is no host password set on the server' , async ( {
116116 expect,
117117 } ) => {
118- await api . put ( '/sessions/current' ) . send ( { role : 'host' } ) . expect ( 201 , {
119- role : 'host' ,
120- runs : [ ] ,
121- } ) ;
118+ await api
119+ . put ( '/sessions/current' )
120+ . send ( { role : 'host' } )
121+ . expect ( 201 , { role : 'host' , runs : [ ] } ) ;
122122 } ) ;
123123
124124 it ( 'should accept the creation of a host role if the provided password is correct' , async ( {
@@ -163,20 +163,19 @@ describe('sessions', () => {
163163
164164 it ( 'should return the current session if it exists' , async ( { expect } ) => {
165165 await api . put ( '/sessions/current' ) . send ( { role : 'participant' } ) ;
166- await api . get ( '/sessions/current' ) . expect ( 200 , {
167- role : 'participant' ,
168- runs : [ ] ,
169- } ) ;
166+ await api
167+ . get ( '/sessions/current' )
168+ . expect ( 200 , { role : 'participant' , runs : [ ] } ) ;
170169 } ) ;
171170 } ) ;
172171
173172 describe ( 'delete /sessions/current' , ( ) => {
174173 it ( 'should return an error if the session does not exists' , async ( {
175174 expect,
176175 } ) => {
177- await api . delete ( '/sessions/current' ) . expect ( 404 , {
178- message : 'No session found' ,
179- } ) ;
176+ await api
177+ . delete ( '/sessions/current' )
178+ . expect ( 404 , { message : 'No session found' } ) ;
180179 } ) ;
181180
182181 it ( 'should delete the current session if it exists' , async ( { expect } ) => {
@@ -195,11 +194,7 @@ describe('runs', () => {
195194 vi . useFakeTimers ( { toFake : [ 'Date' ] } ) ;
196195 vi . setSystemTime ( 1234567890 ) ;
197196 store = MockStore ( ) ;
198- let app = LogServer ( {
199- store,
200- secret : 'secret' ,
201- secureCookies : false ,
202- } ) ;
197+ let app = LogServer ( { store, secret : 'secret' , secureCookies : false } ) ;
203198 api = request . agent ( app ) ;
204199 await api . post ( '/sessions' ) . send ( { role : 'participant' } ) ;
205200 } ) ;
@@ -226,11 +221,14 @@ describe('runs', () => {
226221 it ( 'should use the default experiment if the experiment is not named' , async ( {
227222 expect,
228223 } ) => {
229- await api . post ( '/runs' ) . send ( { runName : 'run' } ) . expect ( 201 , {
230- experimentName : 'addRun:experimentName' ,
231- runName : 'addRun:runName' ,
232- runStatus : 'idle' ,
233- } ) ;
224+ await api
225+ . post ( '/runs' )
226+ . send ( { runName : 'run' } )
227+ . expect ( 201 , {
228+ experimentName : 'addRun:experimentName' ,
229+ runName : 'addRun:runName' ,
230+ runStatus : 'idle' ,
231+ } ) ;
234232 expect ( store . addRun ) . toHaveBeenCalledWith ( {
235233 experimentName : 'default' ,
236234 runName : 'run' ,
@@ -262,16 +260,18 @@ describe('runs', () => {
262260 . post ( '/runs' )
263261 . send ( { experimentName : 'exp-id' , runName : 'run-id' } )
264262 . expect ( 201 ) ;
265- await api . get ( '/sessions/current' ) . expect ( 200 , {
266- role : 'participant' ,
267- runs : [
268- {
269- runName : 'getRun:runName' ,
270- experimentName : 'getRun:experimentName' ,
271- runStatus : 'running' ,
272- } ,
273- ] ,
274- } ) ;
263+ await api
264+ . get ( '/sessions/current' )
265+ . expect ( 200 , {
266+ role : 'participant' ,
267+ runs : [
268+ {
269+ runName : 'getRun:runName' ,
270+ experimentName : 'getRun:experimentName' ,
271+ runStatus : 'running' ,
272+ } ,
273+ ] ,
274+ } ) ;
275275 } ) ;
276276
277277 it ( 'should refuse to create a run if participant already has one running' , async ( {
@@ -540,15 +540,11 @@ describe('runs', () => {
540540 await api
541541 . patch ( '/experiments/exp-id/runs/my-run' )
542542 . send ( { runStatus : 'completed' } )
543- . expect ( 405 , {
544- message : 'Cannot complete a canceled run' ,
545- } ) ;
543+ . expect ( 405 , { message : 'Cannot complete a canceled run' } ) ;
546544 await api
547545 . patch ( '/experiments/exp-id/runs/my-run' )
548546 . send ( { runStatus : 'canceled' } )
549- . expect ( 405 , {
550- message : 'Run is already canceled' ,
551- } ) ;
547+ . expect ( 405 , { message : 'Run is already canceled' } ) ;
552548 expect ( store . setRunStatus ) . not . toHaveBeenCalled ( ) ;
553549 expect ( store . resumeRun ) . not . toHaveBeenCalled ( ) ;
554550 } ) ;
@@ -696,11 +692,7 @@ describe('logs', () => {
696692 . post ( '/experiments/test-exp/runs/not-my-run/logs' )
697693 . send ( {
698694 logs : [
699- {
700- type : 'test-log' ,
701- values : { p1 : 'v1' , p2 : 'v2' } ,
702- number : 1 ,
703- } ,
695+ { type : 'test-log' , values : { p1 : 'v1' , p2 : 'v2' } , number : 1 } ,
704696 ] ,
705697 } )
706698 . expect ( 404 ) ;
@@ -717,11 +709,7 @@ describe('logs', () => {
717709 } )
718710 . expect ( 201 ) ;
719711 expect ( store . addLogs ) . toHaveBeenCalledWith ( myRun . runId , [
720- {
721- type : 'test-log' ,
722- values : { p1 : 'v1' , p2 : 'v2' } ,
723- number : 1 ,
724- } ,
712+ { type : 'test-log' , values : { p1 : 'v1' , p2 : 'v2' } , number : 1 } ,
725713 ] ) ;
726714 } ) ;
727715
0 commit comments