mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	* 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');
 | |
| });
 |