Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: avoid inlining segments for supported clients (#1640)
* 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
- Loading branch information
Showing
16 changed files
with
261 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ClientSpecService } from './client-spec-service'; | ||
import getLogger from '../../test/fixtures/no-logger'; | ||
|
||
test('ClientSpecService validation', async () => { | ||
const service = new ClientSpecService({ getLogger }); | ||
const fn = service.versionSupportsSpec.bind(service); | ||
|
||
expect(fn('segments', undefined)).toEqual(false); | ||
expect(fn('segments', '')).toEqual(false); | ||
|
||
expect(() => fn('segments', 'a')).toThrow('Invalid prefix'); | ||
expect(() => fn('segments', '1.2')).toThrow('Invalid SemVer'); | ||
expect(() => fn('segments', 'v1.2.3')).toThrow('Invalid prefix'); | ||
expect(() => fn('segments', '=1.2.3')).toThrow('Invalid prefix'); | ||
expect(() => fn('segments', '1.2.3.4')).toThrow('Invalid SemVer'); | ||
}); | ||
|
||
test('ClientSpecService segments', async () => { | ||
const service = new ClientSpecService({ getLogger }); | ||
const fn = service.versionSupportsSpec.bind(service); | ||
|
||
expect(fn('segments', '0.0.0')).toEqual(false); | ||
expect(fn('segments', '1.0.0')).toEqual(false); | ||
expect(fn('segments', '4.1.9')).toEqual(false); | ||
|
||
expect(fn('segments', '4.2.0')).toEqual(true); | ||
expect(fn('segments', '4.2.1')).toEqual(true); | ||
expect(fn('segments', '5.0.0')).toEqual(true); | ||
}); |
Oops, something went wrong.