-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(testing): add general code tests, lost console methods (#351)
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`General code checks should only have specific console.[warn|log|info|error] methods: console methods 1`] = ` | ||
Array [ | ||
"redux/common/reduxHelpers.js:167: console.error(\`Error: Property \${prop} does not exist within the passed state.\`, state);", | ||
"redux/common/reduxHelpers.js:171: console.warn(\`Warning: Property \${prop} does not exist within the passed initialState.\`, initialState);", | ||
"setupTests.js:70: console.error = (message, ...args) => {", | ||
] | ||
`; |
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,18 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
describe('General code checks', () => { | ||
const srcDir = 'src'; | ||
|
||
it('should only have specific console.[warn|log|info|error] methods', () => { | ||
const output = execSync( | ||
`echo "$(cd ./${srcDir} && git grep -n -E "(console.warn|console.log|console.info|console.error)")"` | ||
); | ||
|
||
expect( | ||
output | ||
.toString() | ||
.trim() | ||
.split(/[\n\r]/g) | ||
).toMatchSnapshot('console methods'); | ||
}); | ||
}); |