AI Agents SDE Task Viewer
      • Pr description
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-556
  5. changes
  6. pr_description.md
pr_description.md(1.9 KB)· Apr 24, 2026· 2 min read
  • Title
  • Problem
  • Task / Link
  • Changes
  • Notes
  • Testing

Title#

feat(bj-16): add AtlassianMockServer for E2E tiers

Problem#

E2E tiers for the Bitbucket and Jira integration (BJ-8, BJ-9) require a live Atlassian tenant to run, blocking CI reliability and local development. A mock server is needed to intercept all Atlassian REST calls and OAuth token exchanges during test runs.

Task / Link#

Closes #556 (BJ-16: E2E mock server — Atlassian REST APIs)

Changes#

  • Add test/mocks/atlassian-mock-server.ts — AtlassianMockServer class with port-0 HTTP server, Bitbucket /2.0/* and Jira /ex/jira/* route handlers, OAuth fetch shim, and per-request recording
  • Add test/mocks/global-setup.ts / global-teardown.ts — Jest lifecycle hooks that boot/stop the singleton mock and expose ATLASSIAN_MOCK_URL
  • Add test/mocks/atlassian-mock-server.spec.ts — unit tests covering lifecycle, Bitbucket/Jira routes, OAuth shim, 404 fallback, and reset()
  • Update jest.config.js — extend rootDir to . and add test/mocks/**/*.spec.ts to testMatch so mock unit tests run under npm run test
  • Update jest.module.config.js — wire globalSetup / globalTeardown to the new files so module-level E2E runs start/stop the mock server

Notes#

  • The mock uses Node's built-in http — no new npm dependencies
  • OAuth token exchange for https://bitbucket.org/site/oauth2/access_token and https://auth.atlassian.com/oauth/token is intercepted via a globalThis.fetch shim (these URLs cannot be overridden via base-URL config)
  • Tier-specific configs (jest.smoke.config.js) are left untouched; they can opt in when Atlassian scenarios land
  • resetRequests() is the correct per-test isolation boundary (all workers share one server)

Testing#

  • All 6 unit tests in atlassian-mock-server.spec.ts pass: server lifecycle, Bitbucket PR comment, Jira transitions, Jira PUT 204, OAuth shim intercept, reset clears recordings
  • npm run lint passes (zero warnings)
PrdAi-done