Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario T. Lanza committed Jun 3, 2024
1 parent 1c43032 commit d8f46d8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,23 @@ export function test(title, callback, options = {}){
}
}

function check(f, {str = JSON.stringify, expects = null} = {}){
return function(obj, expect = expects){
function check(f, options = {}){
const {str = JSON.stringify} = options;
return function(obj, expect = options.expect){
assert(f(obj), expect, () => str(obj));
}
}

function compare(eq, {str = JSON.stringify, expects = null} = {}){
return function(a, b, expect = expects){
function compare(eq, options = {}){
const {str = JSON.stringify} = options;
return function(a, b, expect = options.expect){
assert(eq(a, b), expect, () => `${str(a)} !== ${str(b)}`);
}
}

function compareAll(eq, {str = JSON.stringify, expects = null} = {}){
return function(xs, expect = expects){
function compareAll(eq, options = {}){
const {str = JSON.stringify} = options;
return function(xs, expect = options.expect){
assert(eq(...xs), expect, () => str(xs));
}
}
Expand Down

0 comments on commit d8f46d8

Please sign in to comment.