| 1 | import { EnvironmentId } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { areProjectPathSearchTargetsEqual } from "./queries"; |
| 5 | |
| 6 | describe("areProjectPathSearchTargetsEqual", () => { |
| 7 | const target = { |
| 8 | environmentId: EnvironmentId.make("environment-a"), |
| 9 | cwd: "/project-a", |
| 10 | query: "index", |
| 11 | }; |
| 12 | |
| 13 | it("requires the environment, workspace, query, entry kind, and image filter to match", () => { |
| 14 | expect(areProjectPathSearchTargetsEqual(target, target)).toBe(true); |
| 15 | expect( |
| 16 | areProjectPathSearchTargetsEqual(target, { |
| 17 | ...target, |
| 18 | environmentId: EnvironmentId.make("environment-b"), |
| 19 | }), |
| 20 | ).toBe(false); |
| 21 | expect(areProjectPathSearchTargetsEqual(target, { ...target, cwd: "/project-b" })).toBe(false); |
| 22 | expect(areProjectPathSearchTargetsEqual(target, { ...target, query: "readme" })).toBe(false); |
| 23 | expect(areProjectPathSearchTargetsEqual(target, { ...target, kind: "file" })).toBe(false); |
| 24 | expect(areProjectPathSearchTargetsEqual(target, { ...target, imageOnly: true })).toBe(false); |
| 25 | }); |
| 26 | }); |