From 5a426635fc92a586f62042462299f4cbb80ec727 Mon Sep 17 00:00:00 2001 From: Adam Azarchs Date: Wed, 18 Jan 2023 12:23:31 -0800 Subject: [PATCH] Make sure test catches regressions. --- __tests__/main.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index ed1d12154..6a969e70b 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -48,10 +48,10 @@ 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 @@ -59,7 +59,9 @@ describe('run', () => { .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'); @@ -82,10 +84,10 @@ 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 @@ -93,7 +95,9 @@ describe('run', () => { .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');