Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugos68 committed Jan 21, 2025
1 parent f7559fc commit dfb972c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/pagefind-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { describe, expect, it } from "vitest";
import { pagefindBuild, pagefindDevelop } from "../src";

describe("pagefindBuild", () => {
it("has `pagefind-build` as name", () => {
const plugin = pagefindBuild();
expect(plugin.name).toBe("pagefind-build");
});
it("only applies to the build phase", () => {
const plugin = pagefindBuild();
expect(plugin.apply).toBe("build");
Expand Down
4 changes: 4 additions & 0 deletions test/pagefind-develop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ vi.mock("package-manager-detector", () => mocks["package-manager-detector"]);
beforeEach(vi.restoreAllMocks);

describe("pagefindDevelop", () => {
it("has `pagefind-develop` as name", () => {
const plugin = pagefindDevelop();
expect(plugin.name).toBe("pagefind-develop");
});
it("only applies to the serve phase", () => {
const plugin = pagefindDevelop();
expect(plugin.apply).toBe("serve");
Expand Down
12 changes: 12 additions & 0 deletions test/pagefind.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, expect, it } from "vitest";
import { pagefind, pagefindBuild, pagefindDevelop } from "../src";

describe("pagefind", () => {
it("returns `pagefindBuild` and `pagefindDevelop` plugins", () => {
const plugins = pagefind();
expect(plugins).toMatchObject([
expect.objectContaining({ name: "pagefind-build" }),
expect.objectContaining({ name: "pagefind-develop" }),
]);
});
});

0 comments on commit dfb972c

Please sign in to comment.