UNPKG

actionhero

Version:

The reusable, scalable, and quick node.js API server for stateless and stateful applications

43 lines (36 loc) 1.36 kB
import { Process, api } from "./../../src"; const actionhero = new Process(); describe("Core", () => { describe("Process", () => { test("a new process can be created", () => { expect(actionhero.initialized).toBe(false); expect(actionhero.started).toBe(false); expect(actionhero.stopped).toBe(false); }); test("a new process can be initialized", async () => { await actionhero.initialize(); expect(actionhero.initialized).toBe(true); expect(actionhero.started).toBe(false); expect(actionhero.stopped).toBe(false); }); test("a new process can be started", async () => { await actionhero.start(); expect(actionhero.initialized).toBe(true); expect(actionhero.started).toBe(true); expect(actionhero.stopped).toBe(false); }); test("a new process can be stopped", async () => { await actionhero.stop("some reason"); expect(actionhero.stopReasons).toEqual(["some reason"]); expect(actionhero.initialized).toBe(false); expect(actionhero.started).toBe(false); expect(actionhero.stopped).toBe(true); }); test("the process is injected into the global API import", () => { //@ts-ignore actionhero["testProperty"] = { a: 1 }; //@ts-ignore expect(api.process["testProperty"]).toEqual({ a: 1 }); }); }); });