mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
7e3f0329ab
* refactor: add semver lib types * refactor: avoid inlining segments for supported clients * refactor: fix FeatureController tests * refactor: use spec version instead of client version * refactor: improve header validation errors
24 lines
1.1 KiB
TypeScript
24 lines
1.1 KiB
TypeScript
import { mustParseStrictSemVer, parseStrictSemVer } from './semver';
|
|
|
|
test('parseStrictSemVer', () => {
|
|
expect(parseStrictSemVer('')).toEqual(null);
|
|
expect(parseStrictSemVer('v')).toEqual(null);
|
|
expect(parseStrictSemVer('v1')).toEqual(null);
|
|
expect(parseStrictSemVer('v1.2.3')).toEqual(null);
|
|
expect(parseStrictSemVer('=1.2.3')).toEqual(null);
|
|
expect(parseStrictSemVer('1.2')).toEqual(null);
|
|
expect(parseStrictSemVer('1.2.3.4')).toEqual(null);
|
|
expect(parseStrictSemVer('1.2.3')!.version).toEqual('1.2.3');
|
|
});
|
|
|
|
test('mustParseSemVer', () => {
|
|
expect(() => mustParseStrictSemVer('').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('1').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('1.2').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('v1.2').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('v1.2.3').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('=1.2.3').version).toThrow();
|
|
expect(() => mustParseStrictSemVer('1.2.3.4').version).toThrow();
|
|
expect(mustParseStrictSemVer('1.2.3').version).toEqual('1.2.3');
|
|
});
|