fix: keep server env out of avatar client bundle
This commit is contained in:
1 parent
5b190cb929
commit
1610aa1008
4 files changed
+46
-32
No files matched your search
+6
-13
@@ -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", () => {
|
||||
|
||||
Reference in new issue
Block a user