Skip to content

Commit

Permalink
feat: add string.includes support
Browse files Browse the repository at this point in the history
  • Loading branch information
ItMaga committed Jul 27, 2023
1 parent de3c648 commit 75db05c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/generators/StringGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class StringGenerator<T extends z.ZodString> implements BaseGener
case 'ip':
string = this.getRandomIP();
break;
case 'includes':
case 'startsWith':
string = `${check.value}${string}`;
break;
Expand Down
5 changes: 5 additions & 0 deletions tests/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ describe('String', () => {
test('endsWith', () => {
const schema = z.string().endsWith('__MARK__');

expect(schema);
});
test('includes', () => {
const schema = z.string().includes('__MARK__');

expect(schema);
});
});

0 comments on commit 75db05c

Please sign in to comment.