@@ -698,88 +698,87 @@ describe("Error messages", async () => {
698698 } ) ;
699699
700700 test ( "format: email (draft-07)" , async ( ) => {
701- registerSchema ( {
702- $schema : "http://json-schema.org/draft-07/schema" ,
703- format : "email"
704- } , schemaUri ) ;
705-
706- const instance = "not-an-email" ;
707- const output = {
708- valid : false ,
709- errors : [
701+ registerSchema ( {
702+ $schema : "http://json-schema.org/draft-07/schema" ,
703+ format : "email"
704+ } , schemaUri ) ;
705+
706+ const instance = "not-an-email" ;
707+ const output = {
708+ valid : false ,
709+ errors : [
710+ {
711+ absoluteKeywordLocation : "https://example.com/main#/format" ,
712+ instanceLocation : "#"
713+ }
714+ ]
715+ } ;
716+
717+ const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
718+ expect ( result . errors ) . to . eql ( [
710719 {
711- absoluteKeywordLocation : "https://example.com/main#/format" ,
712- instanceLocation : "#"
720+ schemaLocation : "https://example.com/main#/format" ,
721+ instanceLocation : "#" ,
722+ message : localization . getFormatErrorMessage ( "email" )
713723 }
714- ]
715- } ;
724+ ] ) ;
725+ } ) ;
716726
717- const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
718- expect ( result . errors ) . to . eql ( [
719- {
720- schemaLocation : "https://example.com/main#/format" ,
721- instanceLocation : "#" ,
722- message : localization . getFormatErrorMessage ( "email" )
723- }
724- ] ) ;
725- } ) ;
727+ test ( "format: email (draft-06)" , async ( ) => {
728+ registerSchema ( {
729+ $schema : "http://json-schema.org/draft-06/schema" ,
730+ format : "email"
731+ } , schemaUri ) ;
732+
733+ const instance = "not-an-email" ;
734+ const output = {
735+ valid : false ,
736+ errors : [
737+ {
738+ absoluteKeywordLocation : "https://example.com/main#/format" ,
739+ instanceLocation : "#"
740+ }
741+ ]
742+ } ;
726743
727- test ( "format: email (draft-06)" , async ( ) => {
728- registerSchema ( {
729- $schema : "http://json-schema.org/draft-06/schema" ,
730- format : "email"
731- } , schemaUri ) ;
744+ const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
732745
733- const instance = "not-an-email" ;
734- const output = {
735- valid : false ,
736- errors : [
746+ expect ( result . errors ) . to . eql ( [
737747 {
738- absoluteKeywordLocation : "https://example.com/main#/format" ,
739- instanceLocation : "#"
748+ schemaLocation : "https://example.com/main#/format" ,
749+ instanceLocation : "#" ,
750+ message : localization . getFormatErrorMessage ( "email" )
740751 }
741- ]
742- } ;
743-
744- const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
752+ ] ) ;
753+ } ) ;
745754
746- expect ( result . errors ) . to . eql ( [
747- {
748- schemaLocation : "https://example.com/main#/format" ,
749- instanceLocation : "#" ,
750- message : localization . getFormatErrorMessage ( "email" )
751- }
752- ] ) ;
753- } ) ;
755+ test ( "format: email (draft-04)" , async ( ) => {
756+ registerSchema ( {
757+ $schema : "http://json-schema.org/draft-04/schema" ,
758+ format : "email"
759+ } , schemaUri ) ;
754760
755- test ( "format: email (draft-04)" , async ( ) => {
761+ const instance = "not-an-email" ;
762+ const output = {
763+ valid : false ,
764+ errors : [
765+ {
766+ absoluteKeywordLocation : "https://example.com/main#/format" ,
767+ instanceLocation : "#"
768+ }
769+ ]
770+ } ;
756771
757- registerSchema ( {
758- $schema : "http://json-schema.org/draft-04/schema" ,
759- format : "email"
760- } , schemaUri ) ;
772+ const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
761773
762- const instance = "not-an-email" ;
763- const output = {
764- valid : false ,
765- errors : [
774+ expect ( result . errors ) . to . eql ( [
766775 {
767- absoluteKeywordLocation : "https://example.com/main#/format" ,
768- instanceLocation : "#"
776+ schemaLocation : "https://example.com/main#/format" ,
777+ instanceLocation : "#" ,
778+ message : localization . getFormatErrorMessage ( "email" )
769779 }
770- ]
771- } ;
772-
773- const result = await betterJsonSchemaErrors ( output , schemaUri , instance ) ;
774-
775- expect ( result . errors ) . to . eql ( [
776- {
777- schemaLocation : "https://example.com/main#/format" ,
778- instanceLocation : "#" ,
779- message : localization . getFormatErrorMessage ( "email" )
780- }
781- ] ) ;
782- } ) ;
780+ ] ) ;
781+ } ) ;
783782
784783 test ( "pattern" , async ( ) => {
785784 registerSchema ( {
0 commit comments