Make sure that empty config options don't accidently label things

This commit is contained in:
Josh Dales
2023-03-20 17:39:57 -04:00
parent 92990c0c57
commit d31255f7be
4 changed files with 26 additions and 17 deletions

View File

@@ -16,7 +16,8 @@ const getPullMock = jest.spyOn(gh.rest.pulls, 'get');
const yamlFixtures = {
'branches.yml': fs.readFileSync('__tests__/fixtures/branches.yml'),
'only_pdfs.yml': fs.readFileSync('__tests__/fixtures/only_pdfs.yml')
'only_pdfs.yml': fs.readFileSync('__tests__/fixtures/only_pdfs.yml'),
'not_supported.yml': fs.readFileSync('__tests__/fixtures/not_supported.yml')
};
afterAll(() => jest.restoreAllMocks());
@@ -48,6 +49,14 @@ describe('run', () => {
expect(addLabelsMock).toHaveBeenCalledTimes(0);
});
it('does not add a label when no match config options match', async () => {
usingLabelerConfigYaml('not_supported.yml');
await run();
expect(addLabelsMock).toHaveBeenCalledTimes(0);
expect(removeLabelMock).toHaveBeenCalledTimes(0);
});
it('(with sync-labels: true) it deletes preexisting PR labels that no longer match the glob pattern', async () => {
const mockInput = {
'repo-token': 'foo',