You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expect(()=>schema.validate({id: 'valid'})).to.throw('Schema with external rules must use validateAsync()');
310
327
});
@@ -322,6 +339,7 @@ describe('Validator', () => {
322
339
});
323
340
324
341
awaitexpect(schema.validateAsync({id: 'valid'})).to.reject('"id" length must be at least 10 characters long');
342
+
expect(awaitschema['~standard'].validate({id: 'valid'})).to.equal({issues: [{message: '"id" length must be at least 10 characters long',path: ['id']}]});
expect(awaitschema['~standard'].validate(input)).to.equal({issues: [{message: '"value" length must be less than or equal to 10 characters long',path: []}]});
562
590
});
563
591
564
592
it('should add multiple errors when errorsArray helper is used',async()=>{
@@ -598,6 +626,7 @@ describe('Validator', () => {
598
626
value: 'my stringmy string'
599
627
}
600
628
}]);
629
+
expect(awaitschema['~standard'].validate(input)).to.equal({issues: [{message: '"value" length must be less than or equal to 10 characters long',path: []},{message: '"value" length must be at least 1 characters long',path: []}]});
601
630
});
602
631
603
632
it('should add a custom error when message helper is used',async()=>{
@@ -621,6 +650,7 @@ describe('Validator', () => {
621
650
custom: 'denied'
622
651
}
623
652
}]);
653
+
expect(awaitschema['~standard'].validate(input)).to.equal({issues: [{message: '"value" has an invalid value my string (denied)',path: []}]});
624
654
});
625
655
626
656
it('should add warnings when warn helper is used on a link',async()=>{
@@ -708,6 +738,7 @@ describe('Validator', () => {
708
738
sign: '>'
709
739
}
710
740
}]);
741
+
expect(awaitschema['~standard'].validate({a: 1,b: 4})).to.equal({issues: [{message: '"b" should be > 4',path: ['b']}]});
711
742
});
712
743
713
744
it('should call multiple externals when abortEarly is false and error helper is used',async()=>{
0 commit comments