@@ -80,7 +80,21 @@ test('with test collection', async (t) => {
8080 t . test ( prepare )
8181
8282 t . test ( `can get ${ testCollection } as admin` , async ( st ) => {
83- const { stderr, stdout } = await run ( 'xst' , [ 'get' , testCollection , '.' , '--threads' , '2' ] , asAdmin )
83+ const { stderr, stdout } = await run ( 'xst' , [ 'get' , testCollection , '.' ] , asAdmin )
84+ if ( stderr ) {
85+ return st . fail ( stderr )
86+ }
87+ st . plan ( 3 )
88+
89+ st . notOk ( stdout , 'no output' )
90+ st . deepEqual ( readdirSync ( testCollectionName ) , expectedDirectoryListing , 'all files were downloaded' )
91+ st . deepEqual ( readdirSync ( testCollectionName + '/subcollection' ) , [ 'b' ] , 'subcollection contents were downloaded' )
92+
93+ await removeLocalDownload ( )
94+ } )
95+
96+ t . test ( `can get ${ testCollection } as admin with just one thread` , async ( st ) => {
97+ const { stderr, stdout } = await run ( 'xst' , [ 'get' , testCollection , '.' , '--threads' , '1' ] , asAdmin )
8498 if ( stderr ) {
8599 return st . fail ( stderr )
86100 }
@@ -94,7 +108,7 @@ test('with test collection', async (t) => {
94108 } )
95109
96110 t . test ( `cannot get ${ testCollection } as guest` , async ( st ) => {
97- const { stderr, stdout } = await run ( 'xst' , [ 'get' , testCollection , '.' , '--threads' , '2' ] )
111+ const { stderr, stdout } = await run ( 'xst' , [ 'get' , testCollection , '.' ] )
98112 if ( stdout ) {
99113 await removeLocalDownload ( )
100114 return st . ok ( stderr )
@@ -108,17 +122,17 @@ test('with test collection', async (t) => {
108122 } )
109123
110124 t . test ( `'xst get --verbose ${ testCollection } ' as admin` , async ( st ) => {
111- const { stderr, stdout } = await run ( 'xst' , [ 'get' , '--verbose' , testCollection , '.' , '--threads' , '2' ] , asAdmin )
125+ const { stderr, stdout } = await run ( 'xst' , [ 'get' , '--verbose' , testCollection , '.' ] , asAdmin )
112126 st . plan ( 9 )
113- st . equal ( stderr , 'Connecting to https://localhost:8443 as admin\n' , stderr )
127+ const verboseLines = stderr . split ( '\n' )
128+ st . equal ( verboseLines [ 0 ] , 'Connecting to https://localhost:8443 as admin' , verboseLines [ 0 ] )
129+ st . ok ( verboseLines [ 1 ] . startsWith ( 'Downloading: /db/get-test to' ) , verboseLines [ 1 ] )
130+ st . equal ( verboseLines [ 2 ] , 'Downloading up to 4 resources at a time' , verboseLines [ 2 ] )
131+ st . equal ( verboseLines [ 3 ] , '' , verboseLines [ 3 ] )
132+ st . equal ( verboseLines . length , 4 , 'all expected lines in verbose output' )
114133
115134 const lines = stdout . split ( '\n' )
116135
117- st . ok ( lines [ 0 ] . startsWith ( 'Downloading: /db/get-test to ' ) )
118- // Server: https://localhost:8443 (v6.1.0-SNAPSHOT)
119- st . ok ( / S e r v e r : [ ^ ] + \( v \d + \. \d + .\d + ( - [ \w \d ] + ) ? \) / . exec ( lines [ 1 ] ) )
120- st . equal ( lines [ 2 ] , 'User: admin' )
121- st . equal ( lines . length , 16 , 'all expected lines in verbose output' )
122136 // files are not downloaded in reproducible order
123137 st . equal (
124138 lines . filter ( ( l ) => / ^ ✔ ︎ c r e a t e d d i r e c t o r y [ / \w ] + \/ g e t - t e s t / . exec ( l ) ) . length ,
0 commit comments