Skip to content

Commit

Permalink
test: include union and constant validators into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
5alidz committed Aug 28, 2021
1 parent abb908a commit f8dccc7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ const Person = createSchema({
{ optional: true }
),
}),
payment_status: _.union(
_.constant('pending'),
_.constant('canceled'),
_.constant('processed'),
_.constant('failed')
),
});

// type IPerson = ReturnType<typeof Person['produce']>;
Expand All @@ -57,6 +63,7 @@ describe('validate', () => {
name: 'abc',
age: 42,
email: '[email protected]',
payment_status: 'pending',
meta: {
id: '123',
created: Date.now(),
Expand All @@ -79,6 +86,7 @@ describe('validate', () => {
created: Date.now(),
updated: new Date().toISOString(),
},
payment_status: 'pending',
});
expect(errors).toStrictEqual({
is_premium: 'invalid-type',
Expand Down

0 comments on commit f8dccc7

Please sign in to comment.