Skip to content

Commit 3b5d4ca

Browse files
committed
Fix type cast for string rule
Signed-off-by: Andrei Kazakou <a.v.kazakou@gmail.com>
1 parent d58a66c commit 3b5d4ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/typescript/rules/string.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ describe('TypeScript Definitions', () => {
3030
});
3131

3232
it('check min length', () => {
33-
const check = v.compile({ $$root: true, type: 'string', min: 5 });
33+
const check = v.compile({ $$root: true, type: 'string', min: 5 } as RuleString);
3434

3535
expect(check('John')).toEqual([{ type: 'stringMin', expected: 5, actual: 4, message: 'The \'\' field length must be greater than or equal to 5 characters long.' }]);
3636
expect(check('Icebob')).toEqual(true);
3737
});
3838

3939
it('check max length', () => {
40-
const check = v.compile({ $$root: true, type: 'string', max: 5 });
40+
const check = v.compile({ $$root: true, type: 'string', max: 5 } as RuleString);
4141

4242
expect(check('John')).toEqual(true);
4343
expect(check('Icebob')).toEqual([{ type: 'stringMax', expected: 5, actual: 6, message: 'The \'\' field length must be less than or equal to 5 characters long.' }]);
4444
});
4545

4646
it('check fix length', () => {
47-
const check = v.compile({ $$root: true, type: 'string', length: 6 });
47+
const check = v.compile({ $$root: true, type: 'string', length: 6 } as RuleString);
4848

4949
expect(check('John')).toEqual([{ type: 'stringLength', expected: 6, actual: 4, message: 'The \'\' field length must be 6 characters long.' }]);
5050
expect(check('Icebob')).toEqual(true);

0 commit comments

Comments
 (0)