/
utils.test.js
35 lines (29 loc) · 1.14 KB
/
utils.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const setDefaults = require('./utils');
const GoogleProvider = require('../provider/googleProvider');
const Serverless = require('../test/serverless');
const GoogleCommand = require('../test/googleCommand');
describe('Utils', () => {
let serverless;
let googleCommand;
beforeEach(() => {
serverless = new Serverless();
serverless.setProvider('google', new GoogleProvider(serverless));
googleCommand = new GoogleCommand(serverless, {}, setDefaults);
});
describe('#setDefaults()', () => {
it('should set default values for options if not provided', () => googleCommand
.setDefaults().then(() => {
expect(googleCommand.options.stage).toEqual('dev');
expect(googleCommand.options.region).toEqual('us-central1');
}));
it('should set the options when they are provided', () => {
googleCommand.options.stage = 'my-stage';
googleCommand.options.region = 'my-region';
return googleCommand.setDefaults().then(() => {
expect(googleCommand.options.stage).toEqual('my-stage');
expect(googleCommand.options.region).toEqual('my-region');
});
});
});
});