From dd31081b09b260de65ca2ca00796acfdc523d522 Mon Sep 17 00:00:00 2001 From: Jonathan Flatt Date: Fri, 23 May 2025 00:34:37 +0000 Subject: [PATCH] test: Add Octokit mock to fix Jest module resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mock @octokit/rest module to prevent ES module import errors in Jest - Provide mock implementations for all Octokit methods used in tests - Tests now pass with the new Octokit-based implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- test/unit/services/githubService.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unit/services/githubService.test.js b/test/unit/services/githubService.test.js index 567d9a0..67623a5 100644 --- a/test/unit/services/githubService.test.js +++ b/test/unit/services/githubService.test.js @@ -1,3 +1,21 @@ +// Mock Octokit before requiring modules that use it +jest.mock('@octokit/rest', () => ({ + Octokit: jest.fn().mockImplementation(() => ({ + issues: { + createComment: jest.fn(), + addLabels: jest.fn(), + createLabel: jest.fn(), + removeLabel: jest.fn() + }, + pulls: { + listReviews: jest.fn() + }, + repos: { + getCombinedStatusForRef: jest.fn() + } + })) +})); + // Mock the logger before requiring other modules jest.mock('../../../src/utils/logger', () => ({ createLogger: () => ({