Add tests for isToolkitVersionString()
This commit is contained in:
Родитель
aa5a00c48a
Коммит
a9fb841731
|
@ -3,6 +3,7 @@ import {
|
|||
isAnyUrl,
|
||||
isSecureUrl,
|
||||
isStrictRelativeUrl,
|
||||
isToolkitVersionString,
|
||||
isValidVersionString,
|
||||
} from 'schema/formats';
|
||||
|
||||
|
@ -50,6 +51,63 @@ describe('formats', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('isToolkitVersionString', () => {
|
||||
const validToolkitVersionStrings = [
|
||||
'1a',
|
||||
'1alpha',
|
||||
'1b',
|
||||
'1beta',
|
||||
'1pre',
|
||||
'1rc',
|
||||
'1.0a1',
|
||||
'1.0.0alpha01',
|
||||
'1.0.0.0b10'
|
||||
'1.0.0beta2',
|
||||
'4.1pre1',
|
||||
'4.1.1pre2',
|
||||
'4.1.1.2pre3',
|
||||
];
|
||||
|
||||
const invalidToolkitVersionStrings = [
|
||||
2,
|
||||
'123e5',
|
||||
'1.',
|
||||
'.',
|
||||
'a.b.c.d',
|
||||
'1.2.2.2.4',
|
||||
'01',
|
||||
'1.000000',
|
||||
'1.000000a1',
|
||||
'2.99999',
|
||||
'3.65536',
|
||||
'3.65536a1',
|
||||
'1.0.0-beta2',
|
||||
'0.1.12dev-cb31c51',
|
||||
'4.1.1dev-abcdef1',
|
||||
'1.0',
|
||||
'2.10.2',
|
||||
'3.1.2.4567',
|
||||
'3.1.2.65535',
|
||||
'1abc',
|
||||
'1.0.0.0.0a',
|
||||
'1.0.0a-1',
|
||||
'1.0.0a1.1',
|
||||
];
|
||||
|
||||
validToolkitVersionStrings.forEach((validToolkitVersionString) => {
|
||||
it(`should find ${validToolkitVersionString} to be valid`, () => {
|
||||
expect(isToolkitVersionString(validToolkitVersionString)).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
invalidToolkitVersionStrings.forEach((invalidToolkitVersionString) => {
|
||||
it(`should find ${invalidToolkitVersionString} to be invalid`, () => {
|
||||
expect(isToolkitVersionString(invalidToolkitVersionString))
|
||||
.toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('URL formats', () => {
|
||||
it('domain', () => {
|
||||
const value = 'https://example.com';
|
||||
|
|
Загрузка…
Ссылка в новой задаче