mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-28 01:36:30 +00:00
75c633dcb5
* dummy commit * cleanup workflows * setup and run eslint * add linter to CI * use eslint for formatting * reorder rules * drop editor config
24 lines
671 B
TypeScript
24 lines
671 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { route } from ".";
|
|
|
|
describe("UrlBuilder", () => {
|
|
it("basic query parameter", () => {
|
|
const result = route("/test", { a: "b" });
|
|
expect(result).toBe("/api/v1/test?a=b");
|
|
});
|
|
|
|
it("multiple query parameters", () => {
|
|
const result = route("/test", { a: "b", c: "d" });
|
|
expect(result).toBe("/api/v1/test?a=b&c=d");
|
|
});
|
|
|
|
it("no query parameters", () => {
|
|
const result = route("/test");
|
|
expect(result).toBe("/api/v1/test");
|
|
});
|
|
|
|
it("list-like query parameters", () => {
|
|
const result = route("/test", { a: ["b", "c"] });
|
|
expect(result).toBe("/api/v1/test?a=b&a=c");
|
|
});
|
|
});
|