This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
-
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.
Merge remote-tracking branch 'origin/master' into update-alpha
- Loading branch information
Showing
22 changed files
with
3,293 additions
and
951 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
16 changes: 16 additions & 0 deletions
16
black-box-tests/acceptance/__snapshots__/generate.spec.ts.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,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ncdc generate can generate multiple configs: toMatchStrippedSnapshot 1`] = ` | ||
"info: JSON schemas have been written to disk | ||
" | ||
`; | ||
|
||
exports[`ncdc generate can run the generate command with noEmit false and composite true: toMatchStrippedSnapshot 1`] = ` | ||
"info: JSON schemas have been written to disk | ||
" | ||
`; | ||
|
||
exports[`ncdc generate can run the generate command: toMatchStrippedSnapshot 1`] = ` | ||
"info: JSON schemas have been written to disk | ||
" | ||
`; |
842 changes: 842 additions & 0 deletions
842
black-box-tests/acceptance/__snapshots__/serve.spec.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
black-box-tests/acceptance/__snapshots__/test.spec.ts.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,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ncdc test can run the test command: toMatchStrippedSnapshot 1`] = ` | ||
"info: PASSED: Shorts - http://localhost:5000/api/resource | ||
" | ||
`; | ||
|
||
exports[`ncdc test can test endpoints that return json: toMatchStrippedSnapshot 1`] = ` | ||
"info: PASSED: Hello - http://localhost:5000/api/resource | ||
" | ||
`; | ||
|
||
exports[`ncdc test does not break when using a rate limit: toMatchStrippedSnapshot 1`] = ` | ||
"info: PASSED: Shorts - http://localhost:5000/api/resource | ||
" | ||
`; | ||
|
||
exports[`ncdc test gives back a useful error message when a type does not exist on the FS: toMatchStrippedSnapshot 1`] = ` | ||
"Code: 1 | Signal: null | Output: | ||
error: An error occurred while validating a fixture within /test-environment/config.yml: | ||
ENOENT: no such file or directory, open '/test-environment/json-schemas/Hello.json' | ||
" | ||
`; | ||
|
||
exports[`ncdc test gives back a useful message when a configured body does not match the real response: toMatchStrippedSnapshot 1`] = ` | ||
"Code: 1 | Signal: null | Output: | ||
error: FAILED: Hello - http://localhost:5000/api/resource | ||
The response body was not deeply equal to your configured fixture | ||
Received: | ||
{ hello: 123 } | ||
error: Not all tests passed | ||
" | ||
`; | ||
|
||
exports[`ncdc test passes even if a request or response has additional properties: toMatchStrippedSnapshot 1`] = ` | ||
"info: PASSED: lel - http://localhost:5000/api/resource | ||
" | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import strip from 'strip-ansi' | ||
import { toMatchSnapshot } from 'jest-snapshot' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace jest { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
interface Matchers<R> { | ||
toMatchStrippedSnapshot(): R | ||
} | ||
} | ||
} | ||
|
||
expect.extend({ | ||
toMatchStrippedSnapshot(received) { | ||
const content = strip(received) | ||
.split('\n') | ||
.map((line) => { | ||
const filePathRegex = /\/(?:.*\/)+test-environment/i | ||
return line.replace(filePathRegex, '/test-environment') | ||
}) | ||
.join('\n') | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore do not know how to fix this "this" type mismatch | ||
return toMatchSnapshot.call(this, content, 'toMatchStrippedSnapshot') | ||
}, | ||
}) |
Oops, something went wrong.