mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 21:31:14 -05:00
feat: Integrate TestDataTracker into all test suites
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import type { TestSuite, TestResult } from '../testRunner';
|
||||
import { TestDataTracker } from '../TestDataTracker';
|
||||
|
||||
export const performanceTestSuite: TestSuite = {
|
||||
id: 'performance',
|
||||
@@ -107,6 +108,7 @@ export const performanceTestSuite: TestSuite = {
|
||||
description: 'Measures performance of version history queries',
|
||||
run: async (): Promise<TestResult> => {
|
||||
const startTime = Date.now();
|
||||
const tracker = new TestDataTracker();
|
||||
let parkId: string | null = null;
|
||||
|
||||
try {
|
||||
@@ -118,13 +120,15 @@ export const performanceTestSuite: TestSuite = {
|
||||
name: 'Test Park Performance',
|
||||
slug: parkSlug,
|
||||
park_type: 'theme_park',
|
||||
status: 'operating'
|
||||
status: 'operating',
|
||||
is_test_data: true
|
||||
})
|
||||
.select('id')
|
||||
.single();
|
||||
|
||||
if (parkError) throw parkError;
|
||||
parkId = park.id;
|
||||
tracker.track('parks', parkId);
|
||||
|
||||
// Create multiple versions (updates)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
@@ -182,8 +186,10 @@ export const performanceTestSuite: TestSuite = {
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
} finally {
|
||||
if (parkId) {
|
||||
await supabase.from('parks').delete().eq('id', parkId);
|
||||
await tracker.cleanup();
|
||||
const remaining = await tracker.verifyCleanup();
|
||||
if (remaining.length > 0) {
|
||||
console.warn('perf-002 cleanup incomplete:', remaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user