Skip to content

Commit f0fee3b

Browse files
Add unit tests
1 parent ddfa8e2 commit f0fee3b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/functional/validation-functions-and-decorators.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ import {
193193
isTaxId,
194194
IsTaxId,
195195
IsISO4217CurrencyCode,
196+
IsISO6391,
196197
} from '../../src/decorator/decorators';
197198
import { Validator } from '../../src/validation/Validator';
198199
import { ValidatorOptions } from '../../src/validation/ValidatorOptions';
@@ -4798,3 +4799,20 @@ describe('IsISO4217', () => {
47984799
return checkInvalidValues(new MyClass(), invalidValues);
47994800
});
48004801
});
4802+
4803+
describe('IsISO6391', () => {
4804+
class MyClass {
4805+
@IsISO6391()
4806+
someProperty: string;
4807+
}
4808+
4809+
it('should not fail for a valid ISO 639-1 language code', () => {
4810+
const validValues = ['de', 'en', 'eo', 'fy', 'nl'];
4811+
return checkValidValues(new MyClass(), validValues);
4812+
});
4813+
4814+
it('should fail for invalid values', () => {
4815+
const invalidValues = [undefined, null, '', 'FR', 'xx', 'tok'];
4816+
return checkInvalidValues(new MyClass(), invalidValues);
4817+
});
4818+
});

0 commit comments

Comments
 (0)