Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbash committed Oct 20, 2021
1 parent 94e3a86 commit 82606fe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/decorators/is-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ describe('IsString', () => {
Result.err('stringField must be a string')
);
});

it('allows empty strings if canBeEmpty is specified', async () => {
class TestCanBeEmpty {
@IsString({ canBeEmpty: true, maxLength: 10 })
stringField!: string;
}

expect(await input(TestCanBeEmpty, { stringField: '' })).toStrictEqual(
Result.ok(make(TestCanBeEmpty, { stringField: '' }))
);
});
});

describe('pattern', () => {
Expand Down Expand Up @@ -265,7 +276,7 @@ describe('IsString', () => {
type: 'object',
properties: {
stringField: {
type: 'array',
type: 'string',
format: 'date-time',
},
},
Expand Down

0 comments on commit 82606fe

Please sign in to comment.