@@ -6,7 +6,7 @@ describe("PostgreSQL Error Condition Mapping", () => {
66 // These tests verify that our mapping logic would work correctly
77 // We can't test the actual Zig functions directly from JS, but we can verify
88 // that the error codes we expect are correctly mapped
9-
9+
1010 const expectedMappings = [
1111 { code : "23505" , condition : "unique_violation" } ,
1212 { code : "23502" , condition : "not_null_violation" } ,
@@ -32,25 +32,25 @@ describe("PostgreSQL Error Condition Mapping", () => {
3232 // Test the pattern that would be used to parse detail messages
3333 const testCases = [
3434 {
35- detail :
' Key (email)=([email protected] ) already exists.' , 36- expectedKey : ' email' ,
37- expectedValue :
' [email protected] ' 35+ detail :
" Key (email)=([email protected] ) already exists." , 36+ expectedKey : " email" ,
37+ expectedValue :
" [email protected] " , 3838 } ,
3939 {
40- detail : ' Key (username)=(john_doe) already exists.' ,
41- expectedKey : ' username' ,
42- expectedValue : ' john_doe'
40+ detail : " Key (username)=(john_doe) already exists." ,
41+ expectedKey : " username" ,
42+ expectedValue : " john_doe" ,
4343 } ,
4444 {
45- detail : ' Key (id)=(12345) already exists.' ,
46- expectedKey : 'id' ,
47- expectedValue : ' 12345'
45+ detail : " Key (id)=(12345) already exists." ,
46+ expectedKey : "id" ,
47+ expectedValue : " 12345" ,
4848 } ,
4949 {
50- detail : ' Key (complex_field)=(value with spaces) already exists.' ,
51- expectedKey : ' complex_field' ,
52- expectedValue : ' value with spaces'
53- }
50+ detail : " Key (complex_field)=(value with spaces) already exists." ,
51+ expectedKey : " complex_field" ,
52+ expectedValue : " value with spaces" ,
53+ } ,
5454 ] ;
5555
5656 testCases . forEach ( ( { detail, expectedKey, expectedValue } ) => {
@@ -69,22 +69,22 @@ describe("PostgreSQL Error Condition Mapping", () => {
6969 test ( "edge cases for key-value parsing" , ( ) => {
7070 const edgeCases = [
7171 {
72- detail : ' Some other error message without key-value format' ,
73- shouldMatch : false
72+ detail : " Some other error message without key-value format" ,
73+ shouldMatch : false ,
7474 } ,
7575 {
76- detail :
' Key (email)=([email protected] ) already exists.' , 77- shouldMatch : true
76+ detail :
" Key (email)=([email protected] ) already exists." , 77+ shouldMatch : true ,
7878 } ,
7979 {
80- detail : '' ,
81- shouldMatch : false
82- }
80+ detail : "" ,
81+ shouldMatch : false ,
82+ } ,
8383 ] ;
8484
8585 edgeCases . forEach ( ( { detail, shouldMatch } ) => {
8686 const keyMatch = detail . match ( / K e y \( ( [ ^ ) ] + ) \) = \( ( [ ^ ) ] + ) \) / ) ;
8787 expect ( ! ! keyMatch ) . toBe ( shouldMatch ) ;
8888 } ) ;
8989 } ) ;
90- } ) ;
90+ } ) ;
0 commit comments