File tree Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,8 @@ module.exports = {
44 testEnvironment : 'node' ,
55 testPathIgnorePatterns : [ '/node_modules/' , '/dist/' ] ,
66} ;
7+
8+ process . env . ROS_REGION_ID = 'cn-hangzhou' ;
9+ process . env . ALIYUN_ACCESS_KEY_ID = 'access key id' ;
10+ process . env . ALIYUN_ACCESS_KEY_SECRET = 'access key secret' ;
11+ process . env . ALIYUN_SECURITY_TOKEN = 'account id' ;
Original file line number Diff line number Diff line change 11import { deploy } from '../../src/commands/deploy' ;
2+ import { defaultContext } from '../fixtures/deployFixture' ;
23
34const mockedDeployStack = jest . fn ( ) ;
45jest . mock ( '../../src/stack' , ( ) => ( {
@@ -9,18 +10,10 @@ jest.mock('../../src/stack', () => ({
910describe ( 'unit test for deploy command' , ( ) => {
1011 it ( 'should construct valid context and deploy the stack when deploy with valid iac' , async ( ) => {
1112 const stackName = 'my-demo-stack' ;
13+
1214 await deploy ( stackName , { location : 'tests/fixtures/serverless-insight.yml' , parameters : { } } ) ;
15+
1316 expect ( mockedDeployStack ) . toHaveBeenCalledTimes ( 1 ) ;
14- expect ( mockedDeployStack ) . toHaveBeenCalledWith ( stackName , expect . any ( Object ) , {
15- accessKeyId : undefined ,
16- accessKeySecret : undefined ,
17- iacLocation :
18- '/Users/blank/Documents/dev/geekfun/serverlessinsight/tests/fixtures/serverless-insight.yml' ,
19- parameters : [ ] ,
20- region : 'cn-hangzhou' ,
21- securityToken : undefined ,
22- stackName : 'my-demo-stack' ,
23- stage : 'default' ,
24- } ) ;
17+ expect ( mockedDeployStack ) . toHaveBeenCalledWith ( stackName , expect . any ( Object ) , defaultContext ) ;
2518 } ) ;
2619} ) ;
Original file line number Diff line number Diff line change @@ -213,3 +213,14 @@ export const oneFcRos = {
213213 } ,
214214 } ,
215215} ;
216+
217+ export const defaultContext = {
218+ accessKeyId : 'access key id' ,
219+ accessKeySecret : 'access key secret' ,
220+ iacLocation : expect . stringContaining ( 'tests/fixtures/serverless-insight.yml' ) ,
221+ parameters : [ ] ,
222+ region : 'cn-hangzhou' ,
223+ securityToken : 'account id' ,
224+ stackName : 'my-demo-stack' ,
225+ stage : 'default' ,
226+ } ;
You can’t perform that action at this time.
0 commit comments