-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from fourTheorem/add-snapshot-testing
feat(tests): add snapshot tests for all test projects
- Loading branch information
Showing
31 changed files
with
27,831 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
}, | ||
plugins: [ | ||
'@typescript-eslint' | ||
], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
ecmaVersion: 2018 | ||
}, | ||
rules: { | ||
'no-new': 0 | ||
}, | ||
extends: [ | ||
'standard-with-typescript' | ||
] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
cdk-test-project/tests/snapshot/cdk-test-project-snapshot.test.ts
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,26 @@ | ||
import { test } from 'tap' | ||
import type { Template } from 'cloudform' | ||
import { handler } from 'cf-macro-slic-watch/index' | ||
|
||
import { setUpSnapshotDefaults } from 'test-utils/snapshot-utils' | ||
|
||
import generalEuStack from './fixtures/CdkGeneralStackTest-Europe.template.json' | ||
import generalUsStack from './fixtures/CdkGeneralStackTest-US.template.json' | ||
import ecsStack from './fixtures/CdkECSStackTest-Europe.template.json' | ||
import stepFunctionStack from './fixtures/CdkSFNStackTest-Europe.template.json' | ||
|
||
const stacks = { generalEuStack, generalUsStack, ecsStack, stepFunctionStack } | ||
|
||
test('the Macro adds SLIC Watch dashboards and alarms to synthesized CDK project', async (t) => { | ||
setUpSnapshotDefaults(t) | ||
for (const [name, stack] of Object.entries(stacks)) { | ||
await t.test(name, async (t) => { | ||
const response = await handler({ fragment: stack as Template, requestId: 'snapshot-test' }) | ||
t.notOk(response.errorMessage) | ||
t.equal(response.status, 'success') | ||
t.equal(response.requestId, 'snapshot-test') | ||
t.matchSnapshot(response.fragment, `${name} fragment`) | ||
}) | ||
} | ||
t.end() | ||
}) |
Oops, something went wrong.