Tools/services/DockerHub.test.ts
2024-03-10 10:17:28 +01:00

23 lines
763 B
TypeScript

import { afterAll, afterEach, beforeAll, describe, expect, it } from "bun:test";
import DockerHub from "./DockerHub";
import server from "./mocks/dockerHubServer";
describe("DockerHub", () => {
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
describe("getLatestVersions", () => {
it("should return the latest versions of an image", async () => {
const dockerHub = new DockerHub();
const versions = await dockerHub.getLatestVersions("vaultwarden/server");
expect(versions).toEqual([
"vaultwarden/server:1.30.5",
"vaultwarden/server:1.30.5-alpine",
"vaultwarden/server:latest",
"vaultwarden/server:latest-alpine",
]);
});
});
});