@@ -67,7 +67,11 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
6767 var fk = table2 . xcolumns . Column1 . foreignkey ;
6868 assert . equal ( fk . tableid , 'Table1' , 'Foreign key should reference Table1' ) ;
6969 assert . equal ( fk . columnid , 'Column1' , 'Foreign key should reference Column1' ) ;
70- assert . equal ( fk . constraintid , 'FK_Table2_Column1' , 'Foreign key should have correct constraint name' ) ;
70+ assert . equal (
71+ fk . constraintid ,
72+ 'FK_Table2_Column1' ,
73+ 'Foreign key should have correct constraint name'
74+ ) ;
7175 } ) ;
7276
7377 it ( 'C) Multiple foreign keys on different columns should all be marked' , function ( ) {
@@ -138,7 +142,10 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
138142 var table = db . tables . TableInline ;
139143
140144 // Inline foreign key should set the foreignkey property
141- assert ( table . xcolumns . RefId . foreignkey , 'RefId should have foreignkey property from inline definition' ) ;
145+ assert (
146+ table . xcolumns . RefId . foreignkey ,
147+ 'RefId should have foreignkey property from inline definition'
148+ ) ;
142149 } ) ;
143150
144151 it ( 'F) Issue example - should detect foreign key in Table2.Column1' , function ( ) {
@@ -174,26 +181,14 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
174181 var table2 = db . tables . Table2 ;
175182
176183 // Table1.Column1 should be marked as primary key
177- assert (
178- table1 . xcolumns . Column1 . primarykey ,
179- 'Table1.Column1 should have primarykey property'
180- ) ;
184+ assert ( table1 . xcolumns . Column1 . primarykey , 'Table1.Column1 should have primarykey property' ) ;
181185
182186 // Table2 columns should be marked as primary key
183- assert (
184- table2 . xcolumns . Column1 . primarykey ,
185- 'Table2.Column1 should have primarykey property'
186- ) ;
187- assert (
188- table2 . xcolumns . Column2 . primarykey ,
189- 'Table2.Column2 should have primarykey property'
190- ) ;
187+ assert ( table2 . xcolumns . Column1 . primarykey , 'Table2.Column1 should have primarykey property' ) ;
188+ assert ( table2 . xcolumns . Column2 . primarykey , 'Table2.Column2 should have primarykey property' ) ;
191189
192190 // Table2.Column1 should be marked as foreign key
193- assert (
194- table2 . xcolumns . Column1 . foreignkey ,
195- 'Table2.Column1 should have foreignkey property'
196- ) ;
191+ assert ( table2 . xcolumns . Column1 . foreignkey , 'Table2.Column1 should have foreignkey property' ) ;
197192 assert . equal ( table2 . xcolumns . Column1 . foreignkey . tableid , 'Table1' ) ;
198193 assert . equal ( table2 . xcolumns . Column1 . foreignkey . columnid , 'Column1' ) ;
199194 } ) ;
@@ -211,9 +206,13 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
211206 assert . equal ( res1 , 1 , 'First insert should succeed' ) ;
212207
213208 // Second insert with same primary key should fail
214- assert . throws ( function ( ) {
215- alasql ( 'INSERT INTO PKTest VALUES (1, "Duplicate")' ) ;
216- } , Error , 'Duplicate primary key should throw error' ) ;
209+ assert . throws (
210+ function ( ) {
211+ alasql ( 'INSERT INTO PKTest VALUES (1, "Duplicate")' ) ;
212+ } ,
213+ Error ,
214+ 'Duplicate primary key should throw error'
215+ ) ;
217216
218217 // Insert with different primary key should succeed
219218 var res2 = alasql ( 'INSERT INTO PKTest VALUES (2, "Second")' ) ;
@@ -245,9 +244,13 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
245244 assert . equal ( res1 , 1 , 'Insert with valid foreign key should succeed' ) ;
246245
247246 // Insert child with invalid foreign key should fail
248- assert . throws ( function ( ) {
249- alasql ( 'INSERT INTO FKChild VALUES (2, 99, "Child2")' ) ;
250- } , Error , 'Insert with invalid foreign key should throw error' ) ;
247+ assert . throws (
248+ function ( ) {
249+ alasql ( 'INSERT INTO FKChild VALUES (2, 99, "Child2")' ) ;
250+ } ,
251+ Error ,
252+ 'Insert with invalid foreign key should throw error'
253+ ) ;
251254
252255 // Verify the foreignkey property is set correctly
253256 var db = alasql . databases [ 'test' + test ] ;
@@ -296,9 +299,13 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
296299 assert . equal ( res1 , 1 , 'First insert should succeed' ) ;
297300
298301 // Insert with same combination should fail
299- assert . throws ( function ( ) {
300- alasql ( 'INSERT INTO CompositePK VALUES (1, 1, "Duplicate")' ) ;
301- } , Error , 'Duplicate composite key should throw error' ) ;
302+ assert . throws (
303+ function ( ) {
304+ alasql ( 'INSERT INTO CompositePK VALUES (1, 1, "Duplicate")' ) ;
305+ } ,
306+ Error ,
307+ 'Duplicate composite key should throw error'
308+ ) ;
302309
303310 // Insert with different Key1 but same Key2 should succeed
304311 var res2 = alasql ( 'INSERT INTO CompositePK VALUES (2, 1, "Different Key1")' ) ;
@@ -336,9 +343,13 @@ describe('Test 1643 - Foreign Key and Primary Key Column Detection', function ()
336343 assert . equal ( res1 , 1 , 'Insert with valid inline foreign key should succeed' ) ;
337344
338345 // Insert with invalid foreign key should fail
339- assert . throws ( function ( ) {
340- alasql ( 'INSERT INTO InlineChild VALUES (2, 99)' ) ;
341- } , Error , 'Insert with invalid inline foreign key should throw error' ) ;
346+ assert . throws (
347+ function ( ) {
348+ alasql ( 'INSERT INTO InlineChild VALUES (2, 99)' ) ;
349+ } ,
350+ Error ,
351+ 'Insert with invalid inline foreign key should throw error'
352+ ) ;
342353
343354 // Verify foreignkey property is set
344355 var db = alasql . databases [ 'test' + test ] ;
0 commit comments