Unified · Split
| @@ -141,11 +141,9 @@ it.effect( · 140 unmodified lines | |||
| 141 | "returns a deterministic bounded page without source fingerprints or raw diagnostics", | 141 | "returns a deterministic bounded page without source fingerprints or raw diagnostics", |
| 142 | () => | 142 | () => |
| 143 | Effect.gen(function* () { | 143 | Effect.gen(function* () { |
| 144 | const observed = yield* Ref.make<ReadonlyArray<unknown>>([]); | ||
| 145 | const service = yield* EnvironmentUsageMcpService; | 144 | const service = yield* EnvironmentUsageMcpService; |
| 146 | const result = yield* service.read(scope, input); | 145 | const result = yield* service.read(scope, input); |
| 147 | yield* encodeEnvironmentUsageResult(result); | 146 | yield* encodeEnvironmentUsageResult(result); |
| 148 | yield* Ref.update(observed, (values) => [...values, result]); | ||
| 149 | 147 | ||
| 150 | expect(result.bucketTotal).toBe(2); | 148 | expect(result.bucketTotal).toBe(2); |
| 151 | expect(result.bucketNextCursor).toBe(1); | 149 | expect(result.bucketNextCursor).toBe(1); |
| @@ -195,6 +193,16 @@ it.effect( · 43 unmodified lines | |||
| 195 | expect(result.costMeaning).toBe("api_equivalent_estimate"); | 193 | expect(result.costMeaning).toBe("api_equivalent_estimate"); |
| 196 | expect(result.paginationConsistency).toBe("live_summary"); | 194 | expect(result.paginationConsistency).toBe("live_summary"); |
| 197 | expect(result.cacheBehavior).toBe("may_refresh_existing_usage_caches"); | 195 | expect(result.cacheBehavior).toBe("may_refresh_existing_usage_caches"); |
| 196 | |||
| 197 | const nextCursor = result.bucketNextCursor ?? assert.fail("expected a second bucket page"); | ||
| 198 | const secondPage = yield* service.read(scope, { ...input, bucketCursor: nextCursor }); | ||
| 199 | yield* encodeEnvironmentUsageResult(secondPage); | ||
| 200 | expect(secondPage).toMatchObject({ | ||
| 201 | bucketCursor: 1, | ||
| 202 | bucketNextCursor: null, | ||
| 203 | bucketTotal: 2, | ||
| 204 | buckets: [{ day: "2026-08-02", provider: "codex", model: { text: "z-model" } }], | ||
| 205 | }); | ||
| 198 | }).pipe(Effect.provide(serviceLayer(() => Effect.succeed(summary)))), | 206 | }).pipe(Effect.provide(serviceLayer(() => Effect.succeed(summary)))), |
| 199 | ); | 207 | ); |
| 200 | 208 | ||