UNPKG

352 BJavaScriptView Raw
1const { expect } = require('chai');
2
3exports.itWrapperCreator = function (fnName, fn) {
4 return function (args, expected) {
5 const serializedArgs = JSON.stringify(args).replace(/(\[|\])/g, '').replace(',', ', ');
6 return it(
7 `${fnName}(${serializedArgs}) => ${expected}`,
8 () => expect(fn(...args)).to.equal(expected),
9 );
10 };
11};