@@ -19,51 +19,45 @@ describe('SauceConnectManager', () => {
1919 ) ;
2020 } ) ;
2121
22- test ( 'error when requesting healthcheck' , async ( ) => {
23- const manager = new SauceConnectManager (
24- {
25- stderr : {
26- on : jest . fn ( ) ,
27- } ,
28- stdout : {
29- on : jest . fn ( ) ,
30- } ,
31- } ,
32- undefined ,
33- {
34- async perform ( ) {
35- throw new Error ( 'custom error' ) ;
36- } ,
37- }
38- ) ;
39- const error = await manager . waitForReady ( ':8042' ) . catch ( ( err ) => err ) ;
40- expect ( error . message ) . toBe ( 'custom error' ) ;
41- } ) ;
42-
43- describe ( 'waiting too long for healthcheck' , ( ) => {
44- let origTimeout = constants . SC_READY_TIMEOUT ;
22+ describe ( 'short ready timeout' , ( ) => {
23+ let origHealthcheckTimeout = constants . SC_HEALTHCHECK_TIMEOUT ;
24+ let origReadyTimeout = constants . SC_READY_TIMEOUT ;
4525 beforeEach ( ( ) => {
4626 // eslint-disable-next-line no-import-assign
47- Object . defineProperty ( constants , 'SC_READY_TIMEOUT' , { value : 10 } ) ;
27+ Object . defineProperty ( constants , 'SC_HEALTHCHECK_TIMEOUT' , { value : 10 } ) ;
28+ // eslint-disable-next-line no-import-assign
29+ Object . defineProperty ( constants , 'SC_READY_TIMEOUT' , { value : 100 } ) ;
4830 } ) ;
4931
50- test ( 'waiting too long for healthcheck' , async ( ) => {
51- const manager = new SauceConnectManager ( {
52- stderr : {
53- on : jest . fn ( ) ,
54- } ,
55- stdout : {
56- on : jest . fn ( ) ,
32+ test ( 'error when requesting healthcheck' , async ( ) => {
33+ const manager = new SauceConnectManager (
34+ {
35+ stderr : {
36+ on : jest . fn ( ) ,
37+ } ,
38+ stdout : {
39+ on : jest . fn ( ) ,
40+ } ,
5741 } ,
58- } ) ;
42+ undefined ,
43+ {
44+ async perform ( ) {
45+ throw new Error ( 'custom error' ) ;
46+ } ,
47+ }
48+ ) ;
5949 const error = await manager . waitForReady ( ':8042' ) . catch ( ( err ) => err ) ;
60- expect ( error . message ) . toBe ( 'Timeout waiting for healthcheck endpoint ' ) ;
50+ expect ( error . message ) . toBe ( 'custom error ' ) ;
6151 } ) ;
6252
6353 afterEach ( ( ) => {
54+ // eslint-disable-next-line no-import-assign
55+ Object . defineProperty ( constants , 'SC_HEALTHCHECK_TIMEOUT' , {
56+ value : origHealthcheckTimeout ,
57+ } ) ;
6458 // eslint-disable-next-line no-import-assign
6559 Object . defineProperty ( constants , 'SC_READY_TIMEOUT' , {
66- value : origTimeout ,
60+ value : origReadyTimeout ,
6761 } ) ;
6862 } ) ;
6963 } ) ;
0 commit comments