Add a test to test the scenario that the previous commit fixes. If a
repo has a malformed CODEOWNERS file that contains just a pattern and
no names the match object will have an empty `owners` array, in which
case resolveCodeOwner should return undefined.

Signed-off-by: Isabel Tomb <isabelgtomb@gmail.com>
This commit is contained in:
Isabel Tomb
2024-12-13 16:30:45 -06:00
parent 3d475a0ddb
commit f59722dcfa
@@ -46,6 +46,14 @@ describe('resolveCodeOwner', () => {
),
).toBe('team-foo');
});
it('should return undefined if the codeowners file contains no names', () => {
expect(
resolveCodeOwner(
`*`,
'https://github.com/acme/repo/tree/docs/catalog-info.yaml',
),
).toBe(undefined);
});
});
describe('normalizeCodeOwner', () => {