Files
outline/server/routes/api/installation/installation.test.ts
Alexandr ZagorskiyandTom Moor 2e1a827157 Feat/installation info endpoint (#7744)
* feat: add installation.info endpoint using DockerHub API

* feat: UI use an server-side API to show version info

* fix: review fixes

* test: installation.info endpoint

* feat: filtering pre-releases in installation.info endpoint

* fix: change fetch to ApiClient usage for getting version info

* Undo translation change

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2024-10-25 06:39:47 -07:00

32 lines
911 B
TypeScript

import { buildUser } from "@server/test/factories";
import { getTestServer } from "@server/test/support";
const server = getTestServer();
describe("installation.info", () => {
it("should require authentication", async () => {
const res = await server.post("/api/installation.info", {
body: {},
});
expect(res.status).toEqual(401);
});
it("should return installation information", async () => {
const user = await buildUser();
const res = await server.post("/api/installation.info", {
body: {
token: user.getJwtToken(),
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data).not.toBeFalsy();
expect(body.data.version).not.toBeFalsy();
expect(body.data.latestVersion).not.toBeFalsy();
expect(typeof body.data.versionsBehind).toBe("number");
expect(body.policies).not.toBeFalsy();
});
});