Skip to content

Write an integration test for the Inngest worker against mocked Octokit #21

Description

@SHAURYASANYAL3

🛑 The Problem

The Inngest worker that fetches GitHub data is the absolute core of our platform. However, because it relies on the live GitHub API, we cannot run it in CI/CD pipelines reliably without hitting rate limits or dealing with network flakes. We need to prove our database insertion logic works without touching the real internet.

💡 The Solution

Write a robust integration test that uses MSW (Mock Service Worker) or Jest/Vitest mocking to intercept the Octokit network requests and return a static JSON fixture of fake commits.

🛠️ Implementation Details

  1. Create a JSON fixture containing 5 realistic GitHub commit payloads.
  2. In a new Vitest file, mock the Octokit client to resolve with the fixture.
  3. Instantiate an in-memory or ephemeral Postgres test database.
  4. Call the Inngest function handler directly (bypassing the Inngest server).
  5. Query the test database and assert that exactly 5 rows were inserted with the correct mapped data.

✅ Acceptance Criteria

  • The test runs 100% offline (no real network requests).
  • It proves that data transformation (API payload -> DB Schema) is correct.
  • The test executes in < 2 seconds.

Ready to tackle this? Comment .take below to get automatically assigned!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions