Skip to content

Commit

Permalink
Allow ffversion without pre-release part
Browse files Browse the repository at this point in the history
  • Loading branch information
tvrg committed Oct 15, 2020
1 parent 8f8b747 commit 39e94a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/snage/src/note/convert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ describe('decode', () => {
});
test('ffversion', () => {
const field: Field = {name: 'version', type: 'ffversion'};
expect(extractLeft(decodeValue(field, '1.1.0'))).toMatchInlineSnapshot(`
expect(extractLeft(decodeValue(field, '1.1'))).toMatchInlineSnapshot(`
Array [
"invalid value \\"1.1.0\\", expected ffversion(marketing.major.minor-patch)",
"invalid value \\"1.1\\", expected ffversion(marketing.major.minor[-patch])",
]
`);
expect(extractRight(decodeValue(field, '1.1.0'))).toMatchInlineSnapshot(`"1.1.0"`);
expect(extractRight(decodeValue(field, '1.1.0-53'))).toMatchInlineSnapshot(`"1.1.0-53"`);
});
test('string', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/snage/src/note/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const dateType = new t.Type<LocalDate, string, unknown>(
);

const ffversionType = new t.Type<string, string, unknown>(
'ffversion(marketing.major.minor-patch)',
'ffversion(marketing.major.minor[-patch])',
(u): u is string => typeof u === 'string',
(u, c) =>
E.either.chain(t.string.validate(u, c), (s) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/snage/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export const expectNever = (value: never): never => {
throw new Error('expected never but got ' + value);
};
export const ffVersionRegex = /(\d+)\.?(\d+)?\.?(\d+)?-?(\d+|SNAPSHOT)?/;
export const requiredFFVersionRegex = /(\d+)\.(\d+)\.(\d+)-(\d+|SNAPSHOT)/;
export const requiredFFVersionRegex = /(\d+)\.(\d+)\.(\d+)-?(\d+|SNAPSHOT)?/;

0 comments on commit 39e94a3

Please sign in to comment.