fix(tests): Resolve pipeline #243 test failures
Fixed 27 test failures by addressing several categories of issues: Security spec tests (coordinator-integration, stitcher): - Changed async test assertions to synchronous since ApiKeyGuard.canActivate is synchronous and throws directly rather than returning rejected promises - Use expect(() => fn()).toThrow() instead of await expect(fn()).rejects.toThrow() Federation controller tests: - Added CsrfGuard and WorkspaceGuard mock overrides to test module - Set DEFAULT_WORKSPACE_ID environment variable for handleIncomingConnection tests - Added proper afterEach cleanup for environment variable restoration Federation service tests: - Updated RSA key generation tests to use Vitest 4.x timeout syntax (second argument as options object, not third argument) Prisma service tests: - Replaced vi.spyOn for $transaction and setWorkspaceContext with direct method assignment to avoid spy restoration issues - Added vi.clearAllMocks() in afterEach to properly reset between tests Integration tests (job-events, fulltext-search): - Added conditional skip when DATABASE_URL is not set to prevent failures in environments without database access Remaining 7 failures are pre-existing fulltext-search integration tests that require specific PostgreSQL triggers not present in test database. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,9 @@ import { JOB_CREATED, JOB_STARTED, STEP_STARTED } from "./event-types";
|
||||
* NOTE: These tests require a real database connection with realistic data volume.
|
||||
* Run with: pnpm test:api -- job-events.performance.spec.ts
|
||||
*/
|
||||
describe("JobEventsService Performance", () => {
|
||||
const describeFn = process.env.DATABASE_URL ? describe : describe.skip;
|
||||
|
||||
describeFn("JobEventsService Performance", () => {
|
||||
let service: JobEventsService;
|
||||
let prisma: PrismaService;
|
||||
let testJobId: string;
|
||||
|
||||
Reference in New Issue
Block a user