fix: keep server env out of avatar client bundle
CI / runtime-diagnostics (push) Skipped
CI / check (push) Successful in 33s
CI / release (push) Skipped
CI / deploy (push) Successful in 49s

This commit is contained in:
Simo committed 2026-08-31 21:41:40 +02:00
1 parent 5b190cb929
commit 1610aa1008
4 files changed
+46 -32

No files matched your search

+6 -13
View File
@@ -1,17 +1,10 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
const envMock = vi.hoisted(() => ({
env: {
NEXT_PUBLIC_IMAGER_URL: "https://img.example.com" as string | undefined,
NEXT_PUBLIC_APP_URL: undefined as string | undefined,
IMAGING_UPSTREAM_URL: "https://up.example.com" as string | undefined,
},
}));
vi.mock("@/env", () => envMock);
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { avatarImageUrl, excerpt, slugify } from "./format";
afterEach(() => {
vi.unstubAllEnvs();
});
describe("slugify", () => {
it("lowercases and hyphenates", () => {
expect(slugify("Hello World!")).toBe("hello-world");
@@ -26,7 +19,7 @@ describe("slugify", () => {
describe("avatarImageUrl", () => {
beforeEach(() => {
envMock.env.NEXT_PUBLIC_IMAGER_URL = "https://img.example.com";
vi.stubEnv("NEXT_PUBLIC_IMAGER_URL", "https://img.example.com");
});
it("appends the figure and options", () => {