@@ -7,13 +7,13 @@ import {expectManifestSchemaConversion} from './utils'
77
88const DESCRIPTOR_CONVERTER = new DescriptorConverter ( )
99
10- function validate ( schema : Schema ) {
11- expectManifestSchemaConversion ( schema , DESCRIPTOR_CONVERTER . get ( schema ) )
10+ async function validate ( schema : Schema ) {
11+ await expectManifestSchemaConversion ( schema , await DESCRIPTOR_CONVERTER . get ( schema ) )
1212}
1313
1414// The schemas are taken from packages/@sanity /schema/test/extractSchema/extractSchema.test.ts
1515describe ( 'ManifestSchemaTypes[] converts to Schema' , ( ) => {
16- test ( 'field with type' , ( ) => {
16+ test ( 'field with type' , async ( ) => {
1717 const schema = createSchema ( {
1818 name : 'test' ,
1919 types : [
@@ -47,10 +47,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
4747 ] ,
4848 } )
4949
50- validate ( schema )
50+ await validate ( schema )
5151 } )
5252
53- test ( 'can convert a simple schema' , ( ) => {
53+ test ( 'can convert a simple schema' , async ( ) => {
5454 const schema = createSchema ( {
5555 name : 'test' ,
5656 types : [
@@ -236,10 +236,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
236236 ] ,
237237 } )
238238
239- validate ( schema )
239+ await validate ( schema )
240240 } )
241241
242- test ( 'all fields are marked as optional without "enforceRequiredFields"' , ( ) => {
242+ test ( 'all fields are marked as optional without "enforceRequiredFields"' , async ( ) => {
243243 const schema = createSchema ( {
244244 name : 'test' ,
245245 types : [
@@ -270,11 +270,11 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
270270 ] ,
271271 } )
272272
273- validate ( schema )
273+ await validate ( schema )
274274 } )
275275
276276 // Skipping as extractManifestSchemaTypes does not allow `enforceRequiredFields`
277- test ( 'optional is set when "enforceRequiredFields"' , { skip : true } , ( ) => {
277+ test ( 'optional is set when "enforceRequiredFields"' , { skip : true } , async ( ) => {
278278 const schema = createSchema ( {
279279 name : 'test' ,
280280 types : [
@@ -311,10 +311,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
311311 ] ,
312312 } )
313313
314- validate ( schema /*, {enforceRequiredFields: true} */ )
314+ await validate ( schema /*, {enforceRequiredFields: true} */ )
315315 } )
316316
317- test ( 'can extract inline documents' , ( ) => {
317+ test ( 'can extract inline documents' , async ( ) => {
318318 const schema = createSchema ( {
319319 name : 'test' ,
320320 types : [
@@ -363,10 +363,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
363363 ] ,
364364 } )
365365
366- validate ( schema )
366+ await validate ( schema )
367367 } )
368368
369- test ( 'will ignore global document reference types at the moment' , ( ) => {
369+ test ( 'will ignore global document reference types at the moment' , async ( ) => {
370370 const schema = createSchema ( {
371371 name : 'test' ,
372372 types : [
@@ -423,10 +423,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
423423 ] ,
424424 } )
425425
426- validate ( schema )
426+ await validate ( schema )
427427 } )
428428
429- test ( 'extracted schema should only include user defined types (and no built-in types)' , ( ) => {
429+ test ( 'extracted schema should only include user defined types (and no built-in types)' , async ( ) => {
430430 const documentType = 'basic'
431431 const schema = createSchema ( {
432432 name : 'test' ,
@@ -439,10 +439,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
439439 ] ,
440440 } )
441441
442- validate ( schema )
442+ await validate ( schema )
443443 } )
444444
445- test ( 'indicate conditional for function values on hidden and readOnly fields' , ( ) => {
445+ test ( 'indicate conditional for function values on hidden and readOnly fields' , async ( ) => {
446446 const documentType = 'basic'
447447
448448 const schema = createSchema ( {
@@ -465,10 +465,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
465465 ] ,
466466 } )
467467
468- validate ( schema )
468+ await validate ( schema )
469469 } )
470470
471- test ( 'should omit known non-serializable schema props ' , ( ) => {
471+ test ( 'should omit known non-serializable schema props ' , async ( ) => {
472472 const documentType = 'remove-props'
473473
474474 const schema = createSchema ( {
@@ -525,10 +525,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
525525 ] ,
526526 } )
527527
528- validate ( schema )
528+ await validate ( schema )
529529 } )
530530
531- test ( 'schema should include most userland properties' , ( ) => {
531+ test ( 'schema should include most userland properties' , async ( ) => {
532532 const documentType = 'basic'
533533
534534 const recursiveObject : any = {
@@ -577,10 +577,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
577577 ] ,
578578 } )
579579
580- validate ( schema )
580+ await validate ( schema )
581581 } )
582582
583- test ( 'should serialize fieldset config' , ( ) => {
583+ test ( 'should serialize fieldset config' , async ( ) => {
584584 const documentType = 'fieldsets'
585585
586586 const schema = createSchema ( {
@@ -605,10 +605,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
605605 ] ,
606606 } )
607607
608- validate ( schema )
608+ await validate ( schema )
609609 } )
610610
611- test ( 'serialize fieldless types' , ( ) => {
611+ test ( 'serialize fieldless types' , async ( ) => {
612612 const documentType = 'fieldless-types'
613613 const schema = createSchema ( {
614614 name : 'test' ,
@@ -641,10 +641,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
641641 ] ,
642642 } )
643643
644- validate ( schema )
644+ await validate ( schema )
645645 } )
646646
647- test ( 'serialize types with fields' , ( ) => {
647+ test ( 'serialize types with fields' , async ( ) => {
648648 const documentType = 'field-types'
649649 const schema = createSchema ( {
650650 name : 'test' ,
@@ -708,10 +708,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
708708 ] ,
709709 } )
710710
711- validate ( schema )
711+ await validate ( schema )
712712 } )
713713
714- test ( 'serialize array-like fields (portable text tested separately)' , ( ) => {
714+ test ( 'serialize array-like fields (portable text tested separately)' , async ( ) => {
715715 const documentType = 'all-types'
716716 const schema = createSchema ( {
717717 name : 'test' ,
@@ -775,10 +775,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
775775 ] ,
776776 } )
777777
778- validate ( schema )
778+ await validate ( schema )
779779 } )
780780
781- test ( 'serialize array with type reference and overridden typename' , ( ) => {
781+ test ( 'serialize array with type reference and overridden typename' , async ( ) => {
782782 const arrayType = 'someArray'
783783 const objectBaseType = 'someObject'
784784 const schema = createSchema ( {
@@ -802,10 +802,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
802802 ] ,
803803 } )
804804
805- validate ( schema )
805+ await validate ( schema )
806806 } )
807807
808- test ( 'serialize schema with indirectly recursive structure' , ( ) => {
808+ test ( 'serialize schema with indirectly recursive structure' , async ( ) => {
809809 const arrayType = 'someArray'
810810 const objectBaseType = 'someObject'
811811 const otherObjectType = 'other'
@@ -840,10 +840,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
840840 ] ,
841841 } )
842842
843- validate ( schema )
843+ await validate ( schema )
844844 } )
845845
846- test ( 'serialize portable text field' , ( ) => {
846+ test ( 'serialize portable text field' , async ( ) => {
847847 const documentType = 'pt'
848848 const schema = createSchema ( {
849849 name : 'test' ,
@@ -902,10 +902,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
902902 ] ,
903903 } )
904904
905- validate ( schema )
905+ await validate ( schema )
906906 } )
907907
908- test ( 'serialize fields with references' , ( ) => {
908+ test ( 'serialize fields with references' , async ( ) => {
909909 const documentType = 'ref-types'
910910 const schema = createSchema ( {
911911 name : 'test' ,
@@ -971,10 +971,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
971971 ] ,
972972 } )
973973
974- validate ( schema )
974+ await validate ( schema )
975975 } )
976976
977- test ( 'fieldsets and fieldset on fields is serialized' , ( ) => {
977+ test ( 'fieldsets and fieldset on fields is serialized' , async ( ) => {
978978 const documentType = 'basic'
979979 const schema = createSchema ( {
980980 name : 'test' ,
@@ -1007,10 +1007,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
10071007 ] ,
10081008 } )
10091009
1010- validate ( schema )
1010+ await validate ( schema )
10111011 } )
10121012
1013- test ( 'do not serialize default titles (default titles added by Schema.compile based on type/field name)' , ( ) => {
1013+ test ( 'do not serialize default titles (default titles added by Schema.compile based on type/field name)' , async ( ) => {
10141014 const documentType = 'basic-document'
10151015 const schema = createSchema ( {
10161016 name : 'test' ,
@@ -1035,10 +1035,10 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
10351035 ] ,
10361036 } )
10371037
1038- validate ( schema )
1038+ await validate ( schema )
10391039 } )
10401040
1041- test ( 'should use the inline type, not the global type for the array.of name-conflicting inline array object items' , ( ) => {
1041+ test ( 'should use the inline type, not the global type for the array.of name-conflicting inline array object items' , async ( ) => {
10421042 const documentType = 'basic-document'
10431043 const schema = createSchema ( {
10441044 name : 'test' ,
@@ -1069,13 +1069,13 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
10691069 ] ,
10701070 } )
10711071
1072- validate ( schema )
1072+ await validate ( schema )
10731073 } )
10741074
10751075 // FIXME: This test will fail because the block type title is set to the default title.
10761076 // When this is serialized, the title will not be set in the _internal_ownProps and thus
10771077 // not be serialized into the descriptor.
1078- test . fails ( 'Defining array type title same as default title should fail' , ( ) => {
1078+ test . fails ( 'Defining array type title same as default title should fail' , async ( ) => {
10791079 const documentType = 'pt'
10801080 const schema = createSchema ( {
10811081 name : 'test' ,
@@ -1101,6 +1101,6 @@ describe('ManifestSchemaTypes[] converts to Schema', () => {
11011101 ] ,
11021102 } )
11031103
1104- validate ( schema )
1104+ await validate ( schema )
11051105 } )
11061106} )
0 commit comments