1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
1
3
// This file was copied and modified from https://github.com/rjsf-team/react-jsonschema-form/blob/b12175679079be956570349771dddd65406b3773/packages/utils/test/schema/getDefaultFormStateTest.ts
2
4
// Licensed under the Apache License, Version 2.0.
3
5
// Modifications made by Roman Krasilnikov.
@@ -1089,7 +1091,8 @@ describe("getDefaultFormState2()", () => {
1089
1091
emptyObjectFields : "populateAllDefaults" ,
1090
1092
allOf : "skipDefaults" ,
1091
1093
arrayMinItems : {
1092
- populate : "populate" as any ,
1094
+ // CHANGED: I don't know why this line is here.
1095
+ // populate: "all" as any,
1093
1096
mergeExtraDefaults : false ,
1094
1097
} ,
1095
1098
mergeDefaultsIntoFormData : "useFormDataIfPresent" ,
@@ -6343,8 +6346,8 @@ describe("getDefaultFormState2()", () => {
6343
6346
expect ( Array . isArray ( result . config . items ) ) . toBe ( true ) ;
6344
6347
6345
6348
// Verify objects are independent instances - modifying one shouldn't affect the other
6346
- ( result . config . items [ 0 ] as any ) . field = "test-value-1" ;
6347
- expect ( ( result . config . items [ 1 ] as any ) . field ) . toBeUndefined ( ) ;
6349
+ result . config . items [ 0 ] . field = "test-value-1" ;
6350
+ expect ( result . config . items [ 1 ] . field ) . toBeUndefined ( ) ;
6348
6351
expect ( result . config . items [ 0 ] ) . not . toBe ( result . config . items [ 1 ] ) ;
6349
6352
} ) ;
6350
6353
@@ -6361,8 +6364,8 @@ describe("getDefaultFormState2()", () => {
6361
6364
expect ( Array . isArray ( result . config . items ) ) . toBe ( true ) ;
6362
6365
6363
6366
// Verify objects are independent instances - modifying one shouldn't affect the other
6364
- ( result . config . items [ 0 ] as any ) . field = "test-value-1" ;
6365
- expect ( ( result . config . items [ 1 ] as any ) . field ) . toBeUndefined ( ) ;
6367
+ result . config . items [ 0 ] . field = "test-value-1" ;
6368
+ expect ( result . config . items [ 1 ] . field ) . toBeUndefined ( ) ;
6366
6369
expect ( result . config . items [ 0 ] ) . not . toBe ( result . config . items [ 1 ] ) ;
6367
6370
} ) ;
6368
6371
@@ -6398,9 +6401,9 @@ describe("getDefaultFormState2()", () => {
6398
6401
expect ( Array . isArray ( result ) ) . toBe ( true ) ;
6399
6402
6400
6403
// Verify objects are independent instances
6401
- ( result [ 0 ] as any ) . field = "test-value-1" ;
6402
- ( result [ 1 ] as any ) . field = "test-value-2" ;
6403
- expect ( ( result [ 2 ] as any ) . field ) . toBeUndefined ( ) ;
6404
+ result [ 0 ] . field = "test-value-1" ;
6405
+ result [ 1 ] . field = "test-value-2" ;
6406
+ expect ( result [ 2 ] . field ) . toBeUndefined ( ) ;
6404
6407
expect ( result [ 0 ] ) . not . toBe ( result [ 1 ] ) ;
6405
6408
expect ( result [ 1 ] ) . not . toBe ( result [ 2 ] ) ;
6406
6409
expect ( result [ 0 ] ) . not . toBe ( result [ 2 ] ) ;
@@ -6442,8 +6445,8 @@ describe("getDefaultFormState2()", () => {
6442
6445
expect ( Array . isArray ( result ) ) . toBe ( true ) ;
6443
6446
6444
6447
// Verify objects are independent instances - modifying one shouldn't affect the other
6445
- ( result [ 0 ] as any ) . field = "modified-value" ;
6446
- expect ( ( result [ 1 ] as any ) . field ) . toBe ( "default-value" ) ;
6448
+ result [ 0 ] . field = "modified-value" ;
6449
+ expect ( result [ 1 ] . field ) . toBe ( "default-value" ) ;
6447
6450
expect ( result [ 0 ] ) . not . toBe ( result [ 1 ] ) ;
6448
6451
} ) ;
6449
6452
@@ -6488,10 +6491,10 @@ describe("getDefaultFormState2()", () => {
6488
6491
expect ( Array . isArray ( result ) ) . toBe ( true ) ;
6489
6492
6490
6493
// Verify nested objects are independent instances
6491
- ( result [ 0 ] as any ) . nested . value = "modified-nested-value" ;
6492
- expect ( ( result [ 1 ] as any ) . nested . value ) . toBe ( "nested-default" ) ;
6494
+ result [ 0 ] . nested . value = "modified-nested-value" ;
6495
+ expect ( result [ 1 ] . nested . value ) . toBe ( "nested-default" ) ;
6493
6496
expect ( result [ 0 ] ) . not . toBe ( result [ 1 ] ) ;
6494
- expect ( ( result [ 0 ] as any ) . nested ) . not . toBe ( ( result [ 1 ] as any ) . nested ) ;
6497
+ expect ( result [ 0 ] . nested ) . not . toBe ( result [ 1 ] . nested ) ;
6495
6498
} ) ;
6496
6499
} ) ;
6497
6500
} ) ;
0 commit comments