mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 12:31:13 -05:00
Improve error formatting in tests
- Replace [object Object] errors with readable messages by using robust error formatting across test suites - Introduce formatTestError helper and apply it in all catch blocks and error throws - Update approvalPipelineTests and related suites to utilize improved error extraction for better debugging
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
verifySubmissionStatus,
|
||||
createParkDirectly,
|
||||
createRideDirectly,
|
||||
formatTestError,
|
||||
} from '../helpers/approvalTestHelpers';
|
||||
|
||||
// ============================================
|
||||
@@ -132,7 +133,7 @@ const parkCreationTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -220,7 +221,7 @@ const rideCreationTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -298,7 +299,7 @@ const companyCreationTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -387,7 +388,7 @@ const rideModelCreationTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -497,7 +498,7 @@ const rideManufacturerCompositeTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -624,7 +625,7 @@ const partialApprovalTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -714,7 +715,7 @@ const idempotencyTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -809,7 +810,7 @@ const parkUpdateTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -897,7 +898,7 @@ const rideUpdateTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -999,7 +1000,7 @@ const rideManufacturerDesignerCompositeTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1097,7 +1098,7 @@ const parkOperatorOwnerCompositeTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1188,7 +1189,7 @@ const lockConflictTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1280,7 +1281,7 @@ const bannedUserTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1373,7 +1374,7 @@ const multipleEditChainTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1478,7 +1479,7 @@ const versionSnapshotIntegrityTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1557,7 +1558,7 @@ const parkPhotoGalleryTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1639,7 +1640,7 @@ const ridePhotoGalleryTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1753,7 +1754,7 @@ const invalidTempRefTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
@@ -1852,7 +1853,7 @@ const concurrentEditTest: Test = {
|
||||
suite: 'Approval Pipeline',
|
||||
status: 'fail',
|
||||
duration: Date.now() - startTime,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatTestError(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user