From f277ea1fd9acb8223a8d3ff0c5e085691c19feaa Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 6 May 2026 11:22:38 -0700 Subject: [PATCH] Remove cookie template function tests --- plugins/template-function-cookie/package.json | 3 +- .../tests/index.test.ts | 62 ------------------- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 plugins/template-function-cookie/tests/index.test.ts diff --git a/plugins/template-function-cookie/package.json b/plugins/template-function-cookie/package.json index 5435bebf..1fd325ec 100644 --- a/plugins/template-function-cookie/package.json +++ b/plugins/template-function-cookie/package.json @@ -6,7 +6,6 @@ "description": "Template functions for working with cookies", "scripts": { "build": "yaakcli build", - "dev": "yaakcli dev", - "test": "vp test --run tests" + "dev": "yaakcli dev" } } diff --git a/plugins/template-function-cookie/tests/index.test.ts b/plugins/template-function-cookie/tests/index.test.ts deleted file mode 100644 index f60bf4a7..00000000 --- a/plugins/template-function-cookie/tests/index.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type { Context } from "@yaakapp/api"; -import { describe, expect, it, vi } from "vite-plus/test"; -import { plugin } from "../src"; - -describe("cookie.value", () => { - const valueFunction = plugin.templateFunctions?.find((f) => f.name === "cookie.value"); - - it("should exist", () => { - expect(valueFunction).toBeDefined(); - }); - - it("should get a cookie by name", async () => { - const getValue = vi.fn().mockResolvedValue("token"); - - const result = await valueFunction?.onRender( - { cookies: { getValue } } as unknown as Context, - { - values: { - name: "co-auth", - }, - purpose: "send", - }, - ); - - expect(result).toBe("token"); - expect(getValue).toHaveBeenCalledWith({ name: "co-auth" }); - }); - - it("should get a cookie by name and domain", async () => { - const getValue = vi.fn().mockResolvedValue("token"); - - const result = await valueFunction?.onRender( - { cookies: { getValue } } as unknown as Context, - { - values: { - name: "co-auth", - domain: " example.com ", - }, - purpose: "send", - }, - ); - - expect(result).toBe("token"); - expect(getValue).toHaveBeenCalledWith({ name: "co-auth", domain: "example.com" }); - }); - - it("should support the legacy cookie_name arg", async () => { - const getValue = vi.fn().mockResolvedValue("token"); - - await valueFunction?.onRender( - { cookies: { getValue } } as unknown as Context, - { - values: { - cookie_name: "co-auth", - }, - purpose: "send", - }, - ); - - expect(getValue).toHaveBeenCalledWith({ name: "co-auth" }); - }); -});