Skip to content

Commit

Permalink
test: add managed basic tests (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS authored Dec 31, 2024
1 parent 11c1108 commit c491a32
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions test/managed.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
const { todo } = require("node:test");
const { describe, it } = require("node:test");
const assert = require("node:assert");
const { Suite } = require("../lib/index");

todo("managed benchmarks", async () => {});
describe("managed benchmarks", async () => {
it("should throw when timer.start isn't called", () => {
const suite = new Suite({ reporter: () => {} });
assert.rejects(
async () => {
suite.add("managed", (timer) => {});
await suite.run();
},
{
message: "You forgot to call .start()",
},
);
});

it("should throw when timer.end isn't called", () => {
const suite = new Suite({ reporter: () => {} });
assert.rejects(
async () => {
suite.add("managed", (timer) => {
timer.start();
});
await suite.run();
},
{
message: "You forgot to call .end(count)",
},
);
});
});

0 comments on commit c491a32

Please sign in to comment.