mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 14:11:13 -05:00
Connect to Lovable Cloud
Apply quick wins and pipeline fixes for integration tests: - Remove is_test_data flag from location inserts - Increase test delay from 2.5s to 5s and add delays between suites to curb rate limiting - Replace [object Object] error formatting with formatTestError across 10 test suites (31 edits) and add import - Refactor unit/conversion tests and performance tests to use the approval pipeline - Extend edge function handling by ensuring item_ids are included in idempotency key inserts (edge function fix) - Update auth, data integrity, edgeFunction, moderation, performance, submission, unitConversion, and versioning test files accordingly
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import { supabase } from '@/lib/supabaseClient';
|
||||
import type { TestSuite, TestResult } from '../testRunner';
|
||||
import { TestDataTracker } from '../TestDataTracker';
|
||||
import { formatTestError } from '../formatTestError';
|
||||
|
||||
export const performanceTestSuite: TestSuite = {
|
||||
id: 'performance',
|
||||
@@ -96,7 +97,7 @@ export const performanceTestSuite: TestSuite = {
|
||||
suite: 'Performance & Scalability',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
}
|
||||
@@ -112,22 +113,36 @@ export const performanceTestSuite: TestSuite = {
|
||||
let parkId: string | null = null;
|
||||
|
||||
try {
|
||||
// Create test park
|
||||
const parkSlug = `test-park-perf-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
const { data: park, error: parkError } = await supabase
|
||||
.from('parks')
|
||||
.insert({
|
||||
name: 'Test Park Performance',
|
||||
slug: parkSlug,
|
||||
park_type: 'theme_park',
|
||||
status: 'operating',
|
||||
is_test_data: true
|
||||
})
|
||||
.select('id')
|
||||
.single();
|
||||
// Import helpers and create park via pipeline
|
||||
const {
|
||||
getCurrentUserId,
|
||||
getAuthToken,
|
||||
generateUniqueParkData,
|
||||
createTestParkSubmission,
|
||||
approveSubmission
|
||||
} = await import('../helpers/approvalTestHelpers');
|
||||
|
||||
const userId = await getCurrentUserId();
|
||||
const authToken = await getAuthToken();
|
||||
const parkData = generateUniqueParkData('perf-002');
|
||||
|
||||
if (parkError) throw new Error(`Park creation failed: ${parkError.message}`);
|
||||
parkId = park.id;
|
||||
const { submissionId, itemId } = await createTestParkSubmission(parkData, userId, tracker);
|
||||
const approval = await approveSubmission(submissionId, [itemId], authToken);
|
||||
|
||||
if (!approval.success) {
|
||||
throw new Error(`Park creation failed: ${approval.error || 'Unknown error'}`);
|
||||
}
|
||||
|
||||
// Get park ID from submission item
|
||||
const { data: parkItem } = await supabase
|
||||
.from('submission_items')
|
||||
.select('approved_entity_id')
|
||||
.eq('id', itemId)
|
||||
.single();
|
||||
|
||||
parkId = parkItem?.approved_entity_id || null;
|
||||
if (!parkId) throw new Error('No park ID after approval');
|
||||
|
||||
tracker.track('parks', parkId);
|
||||
|
||||
// Create multiple versions (updates)
|
||||
@@ -182,7 +197,7 @@ export const performanceTestSuite: TestSuite = {
|
||||
suite: 'Performance & Scalability',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
} finally {
|
||||
@@ -265,7 +280,7 @@ export const performanceTestSuite: TestSuite = {
|
||||
suite: 'Performance & Scalability',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user