UNPKG

actionhero

Version:

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

28 lines (23 loc) 751 B
import { Process, specHelper } from "./../../src/index"; import { Swagger } from "../../src/actions/swagger"; const RunMethod = Swagger.prototype.run; const actionhero = new Process(); describe("Action", () => { describe("swagger", () => { beforeAll(async () => { process.env.AUTOMATIC_ROUTES = "get"; await actionhero.start(); }); afterAll(async () => { await actionhero.stop(); }); test("returns the correct parts", async () => { const { paths, basePath, host } = await specHelper.runAction< typeof RunMethod >("swagger"); expect(basePath).toBe("/api/"); expect(host).toMatch(/localhost/); expect(Object.keys(paths).length).toEqual(9); // 9 actions }); }); });