feat(docker): prepare portable images with runtime hotel configuration
CI / check (push) Successful in 1m6s
CI / deploy (push) Successful in 1m23s

This commit is contained in:
Simo committed 2026-09-07 22:37:53 +02:00
1 parent 745d0b7247
commit c4496e710b
28 files changed
+622 -104

No files matched your search

+4 -28
View File
@@ -1,32 +1,10 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getAvatarUrl, resolveImagerBase } from "./imager";
import { getAvatarUrl } from "./imager";
afterEach(() => {
vi.unstubAllEnvs();
});
describe("resolveImagerBase", () => {
beforeEach(() => {
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "https://img.example.com");
});
it("returns configured imager env var", () => {
expect(resolveImagerBase()).toBe("https://img.example.com");
});
it("strips trailing slashes", () => {
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "https://img.example.com/");
expect(resolveImagerBase()).toBe("https://img.example.com");
});
it("falls back to epicnabbo.nl when env var is not set", () => {
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "");
expect(resolveImagerBase()).toBe(
"https://epicnabbo.nl/imaging/avatarimage",
);
});
});
describe("getAvatarUrl", () => {
beforeEach(() => {
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "https://img.example.com");
@@ -34,7 +12,7 @@ describe("getAvatarUrl", () => {
it("builds a query string with defaults (omits default params)", () => {
const url = getAvatarUrl("hd-180-1");
expect(url.startsWith("https://img.example.com?")).toBe(true);
expect(url.startsWith("/api/imaging/avatar?")).toBe(true);
expect(url).toContain("figure=hd-180-1");
expect(url).not.toContain("direction=2");
expect(url).not.toContain("head_direction=3");
@@ -75,12 +53,10 @@ describe("getAvatarUrl", () => {
expect(url).toContain("effect=0");
});
it("uses epicnabbo.nl when no env var is set", () => {
it("uses the local runtime proxy when no env var is set", () => {
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "");
const url = getAvatarUrl("hd-180-1");
expect(url.startsWith("https://epicnabbo.nl/imaging/avatarimage?")).toBe(
true,
);
expect(url.startsWith("/api/imaging/avatar?")).toBe(true);
expect(url).toContain("img_format=apng");
expect(url).toContain("effect=14");
});