describe("functions", function () { util.checkMethods(functions, function (method, o) { if (o.any) { o.args.forEach(perform); } else { perform(o.args); } function perform(arg) { if (!is.array(arg) || !arg.length) arg = [arg]; var exp = expect( is[method].apply(null, arg) ); if (o.loose) exp.toEqual( o.result ); else exp.toBe( o.result ); } } ); });
describe("auto-currying comparison functions", function () { util.checkMethods(comparisons, function (method, o) { var exp = o.args.reduce( function (fn, arg) { return fn(arg); }, is[method]); exp = expect(exp); if (o.loose) exp.toEqual( o.result ); else exp.toBe( o.result ); } ); it("in", function () { expect( is.in({ a: 'one', b: 'two' }, 'two') ).toBe( true ); expect( is.in(['one', 'two'], 'two') ).toBe( true ); var test = function () { is.in(new Date(), 'whatever'); }; expect( test ).toThrow(); }); });