-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(API): Adding support for passing a template string (#15)
* master adding support for passing a template string * the template string needs to be promised in this chain * templateString tests * resolving lint errors * fixing a lint error on test * master adding update stack test
- Loading branch information
1 parent
fab6b5e
commit baaf47e
Showing
6 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/create-stack/__snapshots__/create-stack-string-template.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`cfn-deploy should successfully create new stack 1`] = ` | ||
Object { | ||
"Capabilities": Array [], | ||
"ChangeSetName": "cfn-deploy", | ||
"ChangeSetType": "CREATE", | ||
"Description": "Created with cfn-deploy", | ||
"Parameters": Array [], | ||
"StackName": "new-stack", | ||
"Tags": Array [], | ||
"TemplateBody": "Resources: | ||
S3Bucket: | ||
Type: AWS::S3::Bucket | ||
", | ||
} | ||
`; | ||
|
||
exports[`cfn-deploy should successfully create new stack 2`] = ` | ||
Object { | ||
"StackStatus": "REVIEW_IN_PROGRESS", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { readFileSync } = require('fs'); | ||
const mockCreateStack = require('../mocks/createStack'); | ||
const lib = require('../..'); | ||
|
||
describe('cfn-deploy', () => { | ||
beforeAll(() => mockCreateStack.beforeAll()); | ||
|
||
it('should successfully create new stack', (done) => { | ||
const events = lib({ | ||
region: 'us-east-1', | ||
stackname: 'new-stack', | ||
templateString: readFileSync('./tests/templates/simple-template.yaml').toString(), | ||
}); | ||
events.on('ERROR', (err) => done(err)); | ||
events.on('COMPLETE', (data) => { | ||
expect(data).toMatchSnapshot(); | ||
}); | ||
events.on('FINALLY', done); | ||
}); | ||
|
||
afterAll(() => mockCreateStack.afterAll()); | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/update-stack/__snapshots__/update-stack-string-template.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`cfn-deploy should successfully create new stack 1`] = ` | ||
Object { | ||
"Capabilities": Array [], | ||
"ChangeSetName": "cfn-deploy", | ||
"ChangeSetType": "UPDATE", | ||
"Description": "Created with cfn-deploy", | ||
"Parameters": Array [], | ||
"StackName": "existing-stack", | ||
"Tags": Array [], | ||
"TemplateBody": "Resources: | ||
S3Bucket: | ||
Type: AWS::S3::Bucket | ||
", | ||
} | ||
`; | ||
|
||
exports[`cfn-deploy should successfully create new stack 2`] = ` | ||
Object { | ||
"StackStatus": "UPDATE_COMPLETE", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { readFileSync } = require('fs'); | ||
const mockCreateStack = require('../mocks/updateStack'); | ||
const lib = require('../..'); | ||
|
||
describe('cfn-deploy', () => { | ||
beforeAll(() => mockCreateStack.beforeAll()); | ||
|
||
it('should successfully create new stack', (done) => { | ||
const events = lib({ | ||
region: 'us-east-1', | ||
stackname: 'existing-stack', | ||
templateString: readFileSync('./tests/templates/simple-template.yaml').toString(), | ||
}); | ||
events.on('ERROR', (err) => done(err)); | ||
events.on('COMPLETE', (data) => { | ||
expect(data).toMatchSnapshot(); | ||
}); | ||
events.on('FINALLY', done); | ||
}); | ||
|
||
afterAll(() => mockCreateStack.afterAll()); | ||
}); |