Skip to content

Commit

Permalink
Make sure test catches regressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-azarchs committed Jan 18, 2023
1 parent b1fa8cc commit 5a42663
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions __tests__/main.test.ts
Expand Up @@ -48,18 +48,20 @@ describe('run', () => {
});

it('(with sync-labels: true) it deletes preexisting PR labels that no longer match the glob pattern', async () => {
let mockInput = {
const mockInput: {[key: string]: string} = {
'repo-token': 'foo',
'configuration-path': 'bar',
'sync-labels': true
'sync-labels': 'true'
};

jest
.spyOn(core, 'getInput')
.mockImplementation((name: string, ...opts) => mockInput[name]);
jest
.spyOn(core, 'getBooleanInput')
.mockImplementation((name: string, ...opts) => mockInput[name]);
.mockImplementation(
(name: string, ...opts) => mockInput[name] === 'true'
);

usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('foo.txt');
Expand All @@ -82,18 +84,20 @@ describe('run', () => {
});

it('(with sync-labels: false) it issues no delete calls even when there are preexisting PR labels that no longer match the glob pattern', async () => {
let mockInput = {
const mockInput: {[key: string]: string} = {
'repo-token': 'foo',
'configuration-path': 'bar',
'sync-labels': false
'sync-labels': 'false'
};

jest
.spyOn(core, 'getInput')
.mockImplementation((name: string, ...opts) => mockInput[name]);
jest
.spyOn(core, 'getBooleanInput')
.mockImplementation((name: string, ...opts) => mockInput[name]);
.mockImplementation(
(name: string, ...opts) => mockInput[name] === 'true'
);

usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('foo.txt');
Expand Down

0 comments on commit 5a42663

Please sign in to comment.