Skip to content

test(concerto-core): mock failed GitHub model request - #1289

Closed
junaidjmomin wants to merge 1 commit into
accordproject:mainfrom
junaidjmomin:junaidjmomin/1286/deterministic-loader-test
Closed

junaidjmomin wants to merge 1 commit into
accordproject:mainfrom
junaidjmomin:junaidjmomin/1286/deterministic-loader-test

Conversation

@junaidjmomin

Copy link
Copy Markdown

Summary

  • Stub the existing global.fetch call with the test's Sinon sandbox.
  • Return a controlled HTTP 404 response for the invalid GitHub model URL.
  • Update the rejection assertion to match the mocked response.

Why

The test for github://external.cto currently makes a live request to raw.githubusercontent.com. GitHub changed the malformed URL response from HTTP 400 to HTTP 404, causing the Core suite to fail. Updating only the expected status would leave the test dependent on external service behavior.

This change keeps coverage of the default model loader path while making the test deterministic and safe to run offline.

Fixes #1286.

Related: #1287.

Validation

  • Isolated ModelManager regression test passes.
  • npm run test -w @accordproject/concerto-core passes: 1,234 passing, 8 pending.
  • Core lint, dependency-boundary, license, documentation, and coverage checks pass.

Author checklist

  • Commit includes DCO sign-off.
  • Change is limited to the affected test.
  • Relevant package test suite passes.

Signed-off-by: junaidjmomin <junaidmominofficial@gmail.com>
@junaidjmomin
junaidjmomin marked this pull request as ready for review August 9, 2026 14:38
Copilot AI lite review requested due to automatic review settings August 9, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes the ModelManager regression test for a bad github:// import deterministic by stubbing global.fetch, so the suite no longer depends on raw.githubusercontent.com returning a specific status code for a malformed URL.

Changes:

  • Stub global.fetch via the test’s Sinon sandbox to prevent live network requests.
  • Mock an HTTP 404 response for the invalid GitHub model URL.
  • Update the rejection assertion to expect the mocked 404 status.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed.

@github-actions github-actions Bot added the Stale label Aug 25, 2026
@mttrbrts

mttrbrts commented Sep 7, 2026

Copy link
Copy Markdown
Member

Thanks for your contribution. This issue has already been fixed.

@mttrbrts mttrbrts closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix failing modelmanager test on bad URL

3 participants