mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-17 00:15:28 +02:00
♻️ Update eslint config (#1424)
This commit is contained in:
parent
01396b6129
commit
d55131c2ab
162 changed files with 337 additions and 266 deletions
51
packages/utils/src/absolute-url.test.ts
Normal file
51
packages/utils/src/absolute-url.test.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { absoluteUrl } from "./absolute-url";
|
||||
|
||||
describe("absoluteUrl", () => {
|
||||
describe("when NEXT_PUBLIC_BASE_URL is set", () => {
|
||||
beforeAll(() => {
|
||||
process.env.NEXT_PUBLIC_BASE_URL = "https://example.com";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
delete process.env.NEXT_PUBLIC_BASE_URL;
|
||||
});
|
||||
|
||||
it("should return the value of NEXT_PUBLIC_BASE_URL", () => {
|
||||
expect(absoluteUrl()).toBe("https://example.com");
|
||||
});
|
||||
it("should return the correct absolute URL with query params", () => {
|
||||
expect(absoluteUrl("/", { test: "test" })).toBe(
|
||||
"https://example.com/?test=test",
|
||||
);
|
||||
});
|
||||
it("should return the correct absolute URL with a subpath and query params", () => {
|
||||
expect(absoluteUrl("/test", { test: "test" })).toBe(
|
||||
"https://example.com/test?test=test",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when NEXT_PUBLIC_BASE_URL is not set", () => {
|
||||
it("should return the correct absolute URL with a subpath and query params", () => {
|
||||
expect(absoluteUrl("/test", { test: "test" })).toBe(
|
||||
"http://localhost:3000/test?test=test",
|
||||
);
|
||||
});
|
||||
|
||||
describe("when NEXT_PUBLIC_VERCEL_URL is set", () => {
|
||||
beforeAll(() => {
|
||||
process.env.NEXT_PUBLIC_VERCEL_URL = "example.vercel.com";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
delete process.env.NEXT_PUBLIC_VERCEL_URL;
|
||||
});
|
||||
|
||||
it("should return the correct absolute URL with a subpath and query params", () => {
|
||||
expect(absoluteUrl("/test", { test: "test" })).toBe(
|
||||
"https://example.vercel.com/test?test=test",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue