Skip to content

Commit

Permalink
chore: misc. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dbushong committed Jul 13, 2017
1 parent 76bc3d0 commit 2f1e063
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"scripts": {
"pretest": "eslint lib test",
"test": "mocha",
"posttest": "nlm verify",
"test-run": "eslint lib test && mocha"
"posttest": "nlm verify"
},
"engines": {
"node": ">=0.8"
Expand Down
22 changes: 5 additions & 17 deletions test/assertive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,7 @@ const notHasType = assert.notHasType;
const resolves = assert.resolves;
const rejects = assert.rejects;

// helper from decaffeinate - useful for now
/* eslint-disable */
function __range__(left, right, inclusive) {
const range = [];
const ascending = left < right;
// eslint-disable-next-line no-nested-ternary
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
range.push(i);
}
return range;
}
/* eslint-enable */
const twoThousand = _.range(1, 2001);

describe('throws', () => {
it('errors out when you provide too few or too many args', () => {
Expand Down Expand Up @@ -470,7 +458,7 @@ haystack: ""`, err.message);
});

it('shortens larger haystacks in the assertion message', () => {
const err = throws(() => include(2001, __range__(1, 2000, true)));
const err = throws(() => include(2001, twoThousand));
match(/^include [\s\S]*haystack: Array\[length: 2000; \d* JSON/, err.message);
});
});
Expand Down Expand Up @@ -556,7 +544,7 @@ describe('notInclude', () => {
});

it('shortens larger haystacks in the assertion message', () => {
const err = throws(() => notInclude(2000, __range__(1, 2000, true)));
const err = throws(() => notInclude(2000, twoThousand));
match(/notInclude[\s\S]*stack: Array\[length: 2000; \d* JSON/, err.message);
});
});
Expand Down Expand Up @@ -606,7 +594,7 @@ describe('match', () => {
});

it('shortens larger strings in the assertion message', () => {
const e = throws(() => match(/4711/, JSON.stringify(__range__(1, 2000, true))));
const e = throws(() => match(/4711/, JSON.stringify(twoThousand)));
include('string String[length: 8894]', e.message);
});
});
Expand Down Expand Up @@ -657,7 +645,7 @@ describe('notMatch', () => {
});

it('shortens larger strings in the assertion message', () => {
const e = throws(() => notMatch(/200/, JSON.stringify(__range__(1, 2000, true))));
const e = throws(() => notMatch(/200/, JSON.stringify(twoThousand)));
include('string String[length: 8894]', e.message);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/promisified.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// test the auto-promise-awarified versions of common tests

const Bluebird = require('bluebird');
const assert = require('../lib/assertive');
const assert = require('../');
const _ = require('lodash');

const syncFuncs = {
Expand Down

0 comments on commit 2f1e063

Please sign in to comment.