git.fiddlerwoaroof.com
t/index.spec.js
d7bc84f6
 import { describe, test, expect } from "@jest/globals";
 import { tests } from "./index_tests";
 
bd196266
 const when = (expect) => (thing) => ({
   isCalledWith(...arglists) {
     let result = thing;
     for (const args of arglists) {
       result = result(...args);
     }
     return {
       get expect() {
         return expect(() => result);
       },
     };
   },
 });
 
 const _expect = function (cb, context, ...args) {
   return expect(cb(context), ...args);
 };
 
d7bc84f6
 tests({
   describe,
   test(desc, cb, ...args) {
     return test(
       desc,
       () => {
         expect.hasAssertions();
         return cb();
       },
       ...args
     );
   },
bd196266
   expect: _expect,
   when: when(_expect),
d7bc84f6
 });