Skip to content

Commit

Permalink
Increment package version
Browse files Browse the repository at this point in the history
  • Loading branch information
Arrow7000 committed Aug 25, 2020
1 parent 44cd316 commit 206e8c0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qew",
"version": "0.10.3",
"version": "0.11.0",
"description": "Queue asynchronous functions",
"source": "qew.ts",
"main": "dist/qew.js",
Expand Down
39 changes: 39 additions & 0 deletions qew.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Qew } from "./qew";

jest.useFakeTimers();

const resolveAfter = <T>(ms: number, value?: T): Promise<T | void> =>
new Promise(resolve => setTimeout(() => resolve(value), ms));

// const mock = jest.fn(() => resolveAfter(1000, "hi"));
const mock = () => resolveAfter(1000, "hi");

// test("Single function gets called immediately", () => {
// const qew = new Qew();

// const prom = qew.push(mock);

// // expect(mock).not.toBeCalled();

// // jest.advanceTimersByTime(1000);

// expect(mock).toBeCalled();
// expect(mock).toHaveBeenCalledTimes(1);

// // await Promise.resolve();
// });

test("Two functions get called one after the other", () => {
const qew = new Qew();

const prom1 = qew.push(mock);
const prom2 = qew.push(mock);

expect(prom1).resolves.toEqual("dfsdf");
expect(prom2).resolves.toEqual("dfsdf");

// expect(mock).toBeCalled();
// expect(mock).toHaveBeenCalledTimes(1);
// jest.advanceTimersByTime(1000);
// expect(mock).toHaveBeenCalledTimes(2);
});

0 comments on commit 206e8c0

Please sign in to comment.