actionhero
Version:
The reusable, scalable, and quick node.js API server for stateless and stateful applications
25 lines (21 loc) • 727 B
text/typescript
import { Process, specHelper } from "./../../src/index";
import { SleepTest } from "../../src/actions/sleepTest";
describe("Action: sleepTest", () => {
const actionhero = new Process();
beforeAll(async () => await actionhero.start());
afterAll(async () => await actionhero.stop());
test("will return data from an async action", async () => {
const { sleepDuration } =
await specHelper.runAction<SleepTest>("sleepTest");
expect(sleepDuration).toEqual(1000);
});
test("can change sleepDuration", async () => {
const { sleepDuration } = await specHelper.runAction<SleepTest>(
"sleepTest",
{
sleepDuration: 100,
},
);
expect(sleepDuration).toEqual(100);
});
});