mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 06:50:51 +00:00
Update tests
This commit is contained in:
parent
b86c598e54
commit
c1cb7da8a5
@ -12,7 +12,7 @@ describe('Email validator', () => {
|
||||
const validator = strapiUtils.validateYupSchema(
|
||||
validators.email(
|
||||
{
|
||||
attr: { type: 'string' },
|
||||
attr: { type: 'email' },
|
||||
},
|
||||
{ isDraft: false }
|
||||
)
|
||||
@ -29,7 +29,7 @@ describe('Email validator', () => {
|
||||
const validator = strapiUtils.validateYupSchema(
|
||||
validators.email(
|
||||
{
|
||||
attr: { type: 'string' },
|
||||
attr: { type: 'email' },
|
||||
},
|
||||
{ isDraft: false }
|
||||
)
|
||||
@ -40,18 +40,14 @@ describe('Email validator', () => {
|
||||
|
||||
test('it validates non-empty email required field', async () => {
|
||||
const validator = strapiUtils.validateYupSchema(
|
||||
validators.email(
|
||||
{
|
||||
attr: { type: 'string', required: true, regex: '^\\w+$' },
|
||||
},
|
||||
{ isDraft: false }
|
||||
)
|
||||
validators.email({ attr: { type: 'email' } }, { isDraft: false })
|
||||
);
|
||||
|
||||
try {
|
||||
await validator('');
|
||||
} catch (err) {
|
||||
expect(err).toBeInstanceOf(YupValidationError);
|
||||
expect(err.message).toBe('this cannot be empty');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user