feat: enhance testing capabilities and introduce new components for question management. Add testing section in AGENTS.md with instructions for running tests and configuring the test environment. Update package.json files to include test scripts and integrate @electric-sql/pglite for in-memory database testing. Introduce CalloutCard and update FilterBar and SoalBrowser components to support visibility filters for private and public questions. Implement new test cases for various functionalities across the application.
92a1d83 Download packages/api/src/lib/__tests__/visibility.test.ts from Atmint/cpns: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/spaces/Atmint/cpns/resolve/main/packages/api/src/lib/__tests__/visibility.test.ts
- Command line
-
hf download hf://spaces/Atmint/cpns/packages/api/src/lib/__tests__/visibility.test.ts
-
curl -L -o visibility.test.ts https://huggingface.co/spaces/Atmint/cpns/resolve/main/packages/api/src/lib/__tests__/visibility.test.ts
667 Bytes
| import { describe, expect, it } from "bun:test"; | |
| import { SQL } from "drizzle-orm"; | |
| import { buildVisibilityCondition } from "../visibility"; | |
| const mockTable = { | |
| isPublic: { name: "isPublic" } as any, | |
| creatorUserId: { name: "creatorUserId" } as any, | |
| }; | |
| describe("buildVisibilityCondition", () => { | |
| it("returns SQL condition when no userId (public only)", () => { | |
| const result = buildVisibilityCondition(mockTable); | |
| expect(result).toBeInstanceOf(SQL); | |
| }); | |
| it("returns SQL condition when userId provided (public or own)", () => { | |
| const result = buildVisibilityCondition(mockTable, "user-123"); | |
| expect(result).toBeInstanceOf(SQL); | |
| }); | |
| }); | |