Skip to content

Commit d543636

Browse files
Stabilize mock cache verification
1 parent 141b1ee commit d543636

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

uapi/tests/MockOrchestrator.test.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,13 @@ describe('MockOrchestrator', () => {
200200

201201
describe('Cache Management', () => {
202202
it('should cache mock data for better performance', async () => {
203-
const start1 = performance.now();
204203
await orchestrator.getMockData('ASSET_PACKS');
205-
const duration1 = performance.now() - start1;
206-
207-
const start2 = performance.now();
208204
await orchestrator.getMockData('ASSET_PACKS');
209-
const duration2 = performance.now() - start2;
210205

211-
// Second call should be faster due to caching
212-
expect(duration2).toBeLessThan(duration1);
206+
const metrics = orchestrator.getPerformanceMetrics();
207+
expect(metrics.mocking.totalMockCalls).toBe(2);
208+
expect(metrics.mocking.cacheHitRatio).toBe(0.5);
209+
expect(metrics.features.ASSET_PACKS?.cacheHitRatio).toBe(0.5);
213210
});
214211

215212
it('should clear cache on reset', async () => {
@@ -387,4 +384,4 @@ function validateMockData(data: any): boolean {
387384
data.metadata &&
388385
data.metadata.version &&
389386
data.metadata.generatedAt;
390-
}
387+
}

0 commit comments

Comments
 (0)