Skip to content

Commit

Permalink
test: use lodash.isEqual instead of tap.strictSame
Browse files Browse the repository at this point in the history
Fixes: #202
PR-URL: #206
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
  • Loading branch information
nechaido authored and belochub committed Jan 22, 2018
1 parent 7f44984 commit f2502b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"babel-preset-es2015": "^6.24.1",
"eslint": "^3.19.0",
"eslint-plugin-import": "^2.3.0",
"lodash.isequal": "^4.5.0",
"remark-cli": "^3.0.1",
"remark-lint": "^6.0.0",
"remark-validate-links": "^6.0.0",
Expand Down
9 changes: 7 additions & 2 deletions test/todo/json5.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const fs = require('fs');
const path = require('path');
const tap = require('tap');
const deepEqual = require('lodash.isequal');
const jstp = require('../..');

const supportedByUs = {
Expand Down Expand Up @@ -58,12 +59,16 @@ testCases.forEach((testCase) => {
test.strictSame(jstp.parse(file), JSON.parse(file));
break;
case '.json5':
test.strictSame(jstp.parse(file), extendedEval(file));
// Currently tap.strictSame() doesn't work well with NaNs.
// That is why we check if lodash.isequal returns true.
test.assert(deepEqual(jstp.parse(file), extendedEval(file)));
break;
case '.js': {
const supportedTests = supportedByUs[testCase.name];
if (supportedTests && supportedTests.includes(testName)) {
test.strictSame(jstp.parse(file), extendedEval(file));
// Currently tap.strictSame() doesn't work well with NaNs.
// That is why we check if lodash.isequal returns true.
test.assert(deepEqual(jstp.parse(file), extendedEval(file)));
} else {
test.throws(() => jstp.parse(file));
}
Expand Down

0 comments on commit f2502b8

Please sign in to comment.