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