feat(catalog): allow using different branches
This commit is contained in:
@@ -30,20 +30,6 @@ describe('ComponentIdValidators', () => {
|
||||
expect(ComponentIdValidators.httpsValidator(arg)).toBe(expected);
|
||||
});
|
||||
});
|
||||
describe('masterValidator', () => {
|
||||
const errorMessage = 'Must reference a file on the master branch.';
|
||||
test.each([
|
||||
[true, '/blob/master/'],
|
||||
[true, 'http://example.com/blob/master/'],
|
||||
[errorMessage, 'blob/master/'],
|
||||
[errorMessage, '/blob/master'],
|
||||
[errorMessage, '/master/'],
|
||||
[errorMessage, ''],
|
||||
[errorMessage, undefined],
|
||||
])('should return %p for %s', (expected: string | boolean, arg: any) => {
|
||||
expect(ComponentIdValidators.masterValidator(arg)).toBe(expected);
|
||||
});
|
||||
});
|
||||
describe('yamlValidator', () => {
|
||||
const errorMessage = "Must end with '.yaml'.";
|
||||
test.each([
|
||||
|
||||
@@ -18,9 +18,6 @@ export const ComponentIdValidators = {
|
||||
httpsValidator: (value: any) =>
|
||||
(typeof value === 'string' && value.match(/^https:\/\//) !== null) ||
|
||||
'Must start with https://.',
|
||||
masterValidator: (value: any) =>
|
||||
(typeof value === 'string' && value.match(/\/blob\/master\//) !== null) ||
|
||||
'Must reference a file on the master branch.',
|
||||
yamlValidator: (value: any) =>
|
||||
(typeof value === 'string' && value.match(/.yaml$/) !== null) ||
|
||||
"Must end with '.yaml'.",
|
||||
|
||||
Reference in New Issue
Block a user