Files
webstudio/packages/sdk/src/url-pattern.test.ts
T
Bogdan Chadkin cb255932bf refactor: migrate CLI tests to vitest (#4409)
Jest is barely maintained and vitest is blazinly faster.
2024-11-13 01:38:19 +04:00

15 lines
559 B
TypeScript

import { expect, test } from "vitest";
import { isPathnamePattern } from "./url-pattern";
test("check pathname is pattern", () => {
expect(isPathnamePattern("/:name")).toEqual(true);
expect(isPathnamePattern("/:slug*")).toEqual(true);
expect(isPathnamePattern("/:id?")).toEqual(true);
expect(isPathnamePattern("/*")).toEqual(true);
expect(isPathnamePattern("")).toEqual(false);
expect(isPathnamePattern("/")).toEqual(false);
expect(isPathnamePattern("/blog")).toEqual(false);
expect(isPathnamePattern("/blog/post-name")).toEqual(false);
});