mirror of
https://github.com/strapi/strapi.git
synced 2025-12-30 00:37:24 +00:00
Add tests to verify schema
This commit is contained in:
parent
3aee21ae0a
commit
29081d0fd3
@ -0,0 +1,47 @@
|
||||
import schema from '../utils/schema';
|
||||
|
||||
describe('schema', () => {
|
||||
it('should failed to validate', () => {
|
||||
expect(() =>
|
||||
schema.validateSync({
|
||||
email_confirmation: true,
|
||||
email_confirmation_redirection: '',
|
||||
email_reset_password: null,
|
||||
})
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it('should success to validate', () => {
|
||||
expect(() =>
|
||||
schema.validateSync({
|
||||
email_confirmation: true,
|
||||
email_confirmation_redirection: 'http://example.com/redirection',
|
||||
email_reset_password: null,
|
||||
})
|
||||
).not.toThrow();
|
||||
|
||||
expect(() =>
|
||||
schema.validateSync({
|
||||
email_confirmation: true,
|
||||
email_confirmation_redirection: 'https://example.com/redirection',
|
||||
email_reset_password: null,
|
||||
})
|
||||
).not.toThrow();
|
||||
|
||||
expect(() =>
|
||||
schema.validateSync({
|
||||
email_confirmation: true,
|
||||
email_confirmation_redirection: 'some://link',
|
||||
email_reset_password: null,
|
||||
})
|
||||
).not.toThrow();
|
||||
|
||||
expect(() =>
|
||||
schema.validateSync({
|
||||
email_confirmation: true,
|
||||
email_confirmation_redirection: 'market://details?id=com.example.com',
|
||||
email_reset_password: null,
|
||||
})
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user