deno.land / x / opine@2.3.4 / test / units / exports.test.ts
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162// deno-lint-ignore-file no-explicit-anyimport { application, opine, request, response, Router } from "../../mod.ts";import { expect, superdeno } from "../deps.ts";import { describe, it } from "../utils.ts";
describe("exports", () => { it("should expose Router", () => { expect(Router).toBeInstanceOf(Function); });
it("should expose the application prototype", () => { expect(application.set).toBeInstanceOf(Function); });
it("should expose the request prototype", () => { expect(request.get).toBeInstanceOf(Function); });
it("should expose the response prototype", () => { expect(response.send).toBeInstanceOf(Function); });
it("should permit modifying the .application prototype", () => { const mockReturnValue = Symbol("test-return-value");
(application as any).mockExtensionMethod = () => { return mockReturnValue; }; expect((opine() as any).mockExtensionMethod()).toEqual(mockReturnValue); });
it("should permit modifying the .request prototype", function (done) { (request as any).foo = function () { return "bar"; }; const app = opine();
app.use(function (req, res, next) { res.end((req as any).foo()); });
superdeno(app) .get("/") .expect("bar", done); });
it("should permit modifying the .response prototype", function (done) { (response as any).foo = function () { (this as any).send("bar"); }; const app = opine();
app.use(function (req, res, next) { (res as any).foo(); });
superdeno(app) .get("/") .expect("bar", done); });});
Version Info