From 21d140736a3aa5675f1b296f7ae9e6551ffef0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Bokvad=20Engar=C3=A5s?= Date: Tue, 3 Oct 2023 13:51:59 +0200 Subject: [PATCH] refactor project --- tests/branchprotection.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/branchprotection.test.ts b/tests/branchprotection.test.ts index 31d2efa4..986491da 100644 --- a/tests/branchprotection.test.ts +++ b/tests/branchprotection.test.ts @@ -62,6 +62,21 @@ describe('BranchProtectionService', () => { expect(warningStub.called).to.be.true; expect(exportVariableStub.calledWith('numberOfReviewers', 0)).to.be.true; }); + it('should call warning and set numberOfReviewers to 0 when github repo is private (status = 403)', async () => { + getOctokitStub.returns({ + rest: { + repos: { + getBranchProtection: sinon.stub().resolves({ + status: 403, + }), + }, + }, + }); + + await BranchProtectionService.getStateOfBranchProtection(); + expect(warningStub.called).to.be.true; + expect(exportVariableStub.calledWith('numberOfReviewers', 0)).to.be.true; + }); // Add more test cases for different scenarios as needed });