From 2daf35ae4b9b338e3bc554cac708f6306c09c7fa Mon Sep 17 00:00:00 2001 From: Josh Dales Date: Sat, 28 Jan 2023 18:08:48 -0500 Subject: [PATCH] Add an extra test now that we can check the base branch --- __tests__/branch.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/__tests__/branch.test.ts b/__tests__/branch.test.ts index 51855ba5..a9d60c81 100644 --- a/__tests__/branch.test.ts +++ b/__tests__/branch.test.ts @@ -32,6 +32,9 @@ describe('checkBranch', () => { github.context.payload.pull_request!.head = { ref: 'test/feature/123' }; + github.context.payload.pull_request!.base = { + ref: 'main' + }; }); describe('when a single pattern is provided', () => { @@ -72,4 +75,13 @@ describe('checkBranch', () => { }); }); }); + + describe('when the branch to check is specified as the base branch', () => { + describe('and the pattern matches the base branch', () => { + it('returns true', () => { + const result = checkBranch(['^main$'], 'base'); + expect(result).toBe(true); + }); + }); + }); });