import { expect, tap } from '@push.rocks/tapbundle'; import * as taskbuffer from '../ts/index.js'; let myNumber = 0; let myTaskOnce: taskbuffer.TaskOnce; tap.test('should create a valid instance of TaskOnce', async () => { myTaskOnce = new taskbuffer.TaskOnce({ taskFunction: async () => { myNumber++; }, }); expect(myTaskOnce).toBeInstanceOf(taskbuffer.TaskOnce); }); tap.test('myNumber should still be 0', async () => { expect(myNumber).toEqual(0); }); tap.test('myTaskOnce should trigger once', async () => { await myTaskOnce.trigger(); await myTaskOnce.trigger(); await myTaskOnce.trigger(); expect(myNumber).toEqual(1); }); tap.start();