Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: form error message without undefined, close #221
- Loading branch information
Showing
6 changed files
with
123 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -115,6 +115,7 @@ | |
"lazy-ass": "1.6.0", | ||
"mkdirp": "0.5.1", | ||
"pluralize": "7.0.0", | ||
"quote": "0.4.0", | ||
"ramda": "0.26.1" | ||
} | ||
} |
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,64 @@ | ||
'use strict' | ||
|
||
const la = require('lazy-ass') | ||
const is = require('check-more-types') | ||
const { stripIndent } = require('common-tags') | ||
|
||
/* eslint-env mocha */ | ||
describe('throwCannotSaveOnCI', () => { | ||
const { throwCannotSaveOnCI } = require('./index') | ||
|
||
it('is a function', () => { | ||
la(is.fn(throwCannotSaveOnCI)) | ||
}) | ||
|
||
it('throws good message for auto formed', () => { | ||
try { | ||
throwCannotSaveOnCI({ | ||
value: 'foo', | ||
fileParameter: 'spec.js', | ||
exactSpecName: null, | ||
specName: 'my spec', | ||
index: 1 | ||
}) | ||
} catch (e) { | ||
const expected = stripIndent` | ||
Cannot store new snapshot value | ||
in "spec.js" | ||
for snapshot called "my spec" | ||
test key "my spec 1" | ||
when running on CI (opts.ci = 1) | ||
see https://github.com/bahmutov/snap-shot-core/issues/5 | ||
` | ||
la( | ||
e.message === expected, | ||
'expected:\n' + expected + '\n\nactual:\n' + e.message | ||
) | ||
} | ||
}) | ||
|
||
it('throws good message for exact snapshot name', () => { | ||
try { | ||
throwCannotSaveOnCI({ | ||
value: 'foo', | ||
fileParameter: 'spec.js', | ||
exactSpecName: 'my snapshot name', | ||
specName: null, | ||
index: null | ||
}) | ||
} catch (e) { | ||
const expected = stripIndent` | ||
Cannot store new snapshot value | ||
in "spec.js" | ||
for snapshot called "my snapshot name" | ||
test key "my snapshot name" | ||
when running on CI (opts.ci = 1) | ||
see https://github.com/bahmutov/snap-shot-core/issues/5 | ||
` | ||
la( | ||
e.message === expected, | ||
'expected:\n' + expected + '\n\nactual:\n' + e.message | ||
) | ||
} | ||
}) | ||
}) |
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