1
1
const { expect } = require ( "chai" ) ;
2
2
const chai = require ( "chai" ) ,
3
3
chaiAsPromised = require ( "chai-as-promised" ) ,
4
- sinon = require ( 'sinon' )
4
+ sinon = require ( 'sinon' ) ,
5
5
request = require ( 'axios' ) ;
6
6
7
7
const logger = require ( "../../../../bin/helpers/logger" ) . winstonLogger ,
8
8
testObjects = require ( "../../support/fixtures/testObjects" ) ,
9
- utils = require ( '../../../../bin/helpers/utils' )
10
- // atsHelper = require('../../../../bin/helpers/atsHelper.js');
9
+ utils = require ( '../../../../bin/helpers/utils' ) ,
10
+ atsHelper = require ( '../../../../bin/helpers/atsHelper.js' ) ;
11
11
12
12
chai . use ( chaiAsPromised ) ;
13
13
logger . transports [ "console.info" ] . silent = true ;
@@ -28,48 +28,48 @@ describe('#atsHelper', () => {
28
28
describe ( '#isTurboScaleSession' , ( ) => {
29
29
it ( 'return true if env var set to true' , ( ) => {
30
30
process . env . BROWSERSTACK_TURBOSCALE = "true" ;
31
- // expect(atsHelper.isTurboScaleSession(bsConfig)).to.be.true;
31
+ expect ( atsHelper . isTurboScaleSession ( bsConfig ) ) . to . be . true ;
32
32
delete BROWSERSTACK_TURBOSCALE ;
33
33
} ) ;
34
34
35
35
it ( 'return false if env var set to incorrect value' , ( ) => {
36
36
process . env . BROWSERSTACK_TURBOSCALE = "false" ;
37
- // expect(atsHelper.isTurboScaleSession(bsConfig)).to.be.false;
37
+ expect ( atsHelper . isTurboScaleSession ( bsConfig ) ) . to . be . false ;
38
38
delete BROWSERSTACK_TURBOSCALE ;
39
39
} ) ;
40
40
41
41
it ( 'return true if set in config' , ( ) => {
42
- // expect(atsHelper.isTurboScaleSession(testObjects.sampleATSBsConfig)).to.be.true;
42
+ expect ( atsHelper . isTurboScaleSession ( testObjects . sampleATSBsConfig ) ) . to . be . true ;
43
43
} ) ;
44
44
45
45
it ( 'return false if not set in config as well as env var' , ( ) => {
46
- // expect(atsHelper.isTurboScaleSession(bsConfig)).to.be.false;
46
+ expect ( atsHelper . isTurboScaleSession ( bsConfig ) ) . to . be . false ;
47
47
} ) ;
48
48
} ) ;
49
49
50
50
describe ( '#getTurboScaleOptions' , ( ) => {
51
51
it ( 'return empty object if not set' , ( ) => {
52
- // expect(atsHelper.getTurboScaleOptions(testObjects.sampleATSBsConfig)).to.deep.include({});
52
+ expect ( atsHelper . getTurboScaleOptions ( testObjects . sampleATSBsConfig ) ) . to . deep . include ( { } ) ;
53
53
} ) ;
54
54
55
55
it ( 'return obj if set in config' , ( ) => {
56
- // expect(atsHelper.getTurboScaleOptions(testObjects.sampleATSBsConfigWithOptions)).to.deep.include({ gridName: 'abc' });
56
+ expect ( atsHelper . getTurboScaleOptions ( testObjects . sampleATSBsConfigWithOptions ) ) . to . deep . include ( { gridName : 'abc' } ) ;
57
57
} ) ;
58
58
} ) ;
59
59
60
60
describe ( '#getTurboScaleGridName' , ( ) => {
61
61
it ( 'return value set by env var' , ( ) => {
62
62
process . env . BROWSERSTACK_TURBOSCALE_GRID_NAME = "my-grid" ;
63
- // expect(atsHelper.getTurboScaleGridName(testObjects.sampleATSBsConfigWithOptions)).to.eq('my-grid');
63
+ expect ( atsHelper . getTurboScaleGridName ( testObjects . sampleATSBsConfigWithOptions ) ) . to . eq ( 'my-grid' ) ;
64
64
delete process . env . BROWSERSTACK_TURBOSCALE_GRID_NAME ;
65
65
} ) ;
66
66
67
67
it ( 'return value set in config' , ( ) => {
68
- // expect(atsHelper.getTurboScaleGridName(testObjects.sampleATSBsConfigWithOptions)).to.eq('abc');
68
+ expect ( atsHelper . getTurboScaleGridName ( testObjects . sampleATSBsConfigWithOptions ) ) . to . eq ( 'abc' ) ;
69
69
} ) ;
70
70
71
71
it ( 'return NO_GRID_NAME_PASSED if value not set in config as well as env var' , ( ) => {
72
- // expect(atsHelper.getTurboScaleGridName(bsConfig)).to.eq('NO_GRID_NAME_PASSED');
72
+ expect ( atsHelper . getTurboScaleGridName ( bsConfig ) ) . to . eq ( 'NO_GRID_NAME_PASSED' ) ;
73
73
} ) ;
74
74
} ) ;
75
75
@@ -87,9 +87,9 @@ describe('#atsHelper', () => {
87
87
88
88
requestStub . yields ( null , { statusCode : 200 } , body ) ;
89
89
sendUsageReportStub . notCalled ;
90
- // atsHelper.getTurboScaleGridDetails(testObjects.sampleATSBsConfigWithOptions, {}, {}).then((result) => {
91
- // expect(result).to.eq(body);
92
- // })
90
+ atsHelper . getTurboScaleGridDetails ( testObjects . sampleATSBsConfigWithOptions , { } , { } ) . then ( ( result ) => {
91
+ expect ( result ) . to . eq ( body ) ;
92
+ } )
93
93
} ) ;
94
94
95
95
it ( 'reject with empty object' , ( ) => {
@@ -104,10 +104,10 @@ describe('#atsHelper', () => {
104
104
} ;
105
105
106
106
requestStub . yields ( null , { statusCode : 422 } , body ) ;
107
- // atsHelper.getTurboScaleGridDetails(testObjects.sampleATSBsConfigWithOptions, {}, {}).then((result) => {
108
- // expect(result).to.eq({});
109
- // expect(sendUsageReportStub.calledOnce).to.be.true;
110
- // })
107
+ atsHelper . getTurboScaleGridDetails ( testObjects . sampleATSBsConfigWithOptions , { } , { } ) . then ( ( result ) => {
108
+ expect ( result ) . to . eq ( { } ) ;
109
+ expect ( sendUsageReportStub . calledOnce ) . to . be . true ;
110
+ } )
111
111
} ) ;
112
112
} ) ;
113
113
} ) ;
0 commit comments