|
1 | 1 | import type { SDKModel } from "@cursor/sdk"; |
2 | 2 | import { describe, expect, it } from "@effect/vitest"; |
3 | 3 | import * as Effect from "effect/Effect"; |
| 4 | +import * as Fiber from "effect/Fiber"; |
4 | 5 | import * as Schema from "effect/Schema"; |
| 6 | +import * as TestClock from "effect/testing/TestClock"; |
5 | 7 | import type { CursorSettings } from "../settings.ts"; |
6 | 8 | import { CursorSettings as CursorSettingsSchema } from "../settings.ts"; |
7 | 9 | import { createModelCapabilities } from "@t3tools/shared/model"; |
@@ -354,6 +356,36 @@ describe("checkCursorProviderStatus", () => { |
354 | 356 | }), |
355 | 357 | ); |
356 | 358 |
|
| 359 | + it.effect("does not report a single slow catalog read as a provider error", () => |
| 360 | + Effect.gen(function* () { |
| 361 | + let reads = 0; |
| 362 | + const fiber = yield* checkCursorProviderStatus(baseCursorSettings, { |
| 363 | + CURSOR_API_KEY: "test-cursor-key", |
| 364 | + }).pipe( |
| 365 | + Effect.provide( |
| 366 | + CursorSdkCatalog.layerTest(() => { |
| 367 | + reads += 1; |
| 368 | + return reads === 1 |
| 369 | + ? Effect.never |
| 370 | + : Effect.succeed({ |
| 371 | + user: { |
| 372 | + apiKeyName: "test-key", |
| 373 | + |
| 374 | + createdAt: "2026-01-01T00:00:00.000Z", |
| 375 | + }, |
| 376 | + models: [sdkParameterizedModel], |
| 377 | + }); |
| 378 | + }), |
| 379 | + ), |
| 380 | + Effect.forkChild({ startImmediately: true }), |
| 381 | + ); |
| 382 | + yield* TestClock.adjust("1 minute"); |
| 383 | + const provider = yield* Fiber.join(fiber); |
| 384 | + |
| 385 | + expect(provider.status).not.toBe("error"); |
| 386 | + }), |
| 387 | + ); |
| 388 | + |
357 | 389 | it.effect("requires a Cursor API key without probing any external Cursor binary", () => |
358 | 390 | Effect.gen(function* () { |
359 | 391 | const provider = yield* checkCursorProviderStatus(baseCursorSettings).pipe( |
|
0 commit comments