Skip to content

fix: align sveltekit adapter tests with dispatch() catch-all pattern#943

Merged
hotlong merged 4 commits intomainfrom
copilot/fix-all-ci-errors-another-one
Mar 21, 2026
Merged

fix: align sveltekit adapter tests with dispatch() catch-all pattern#943
hotlong merged 4 commits intomainfrom
copilot/fix-all-ci-errors-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

SvelteKit adapter was refactored to use the unified dispatcher.dispatch() catch-all (like all other adapters), but tests still mocked the old handleMetadata/handleData methods — causing 7/19 tests to fail with 500s.

  • Replaced handleMetadata/handleData in mock with dispatch
  • Updated assertions for metadata, data, error handling, and toResponse tests to match the catch-all contract
// Before (stale mock — dispatch() undefined → throws → 500)
const mockDispatcher = {
  handleMetadata: vi.fn().mockResolvedValue({ ... }),
  handleData: vi.fn().mockResolvedValue({ ... }),
};

// After (matches implementation)
const mockDispatcher = {
  dispatch: vi.fn().mockResolvedValue({ handled: true, response: { body: { success: true }, status: 200 } }),
};

Aligned with the hono adapter test conventions, which already use this pattern.

Original prompt

fix all ci errors


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Mar 21, 2026 9:09am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
spec Ignored Ignored Mar 21, 2026 9:09am

Request Review

The sveltekit adapter implementation uses dispatcher.dispatch() for the
catch-all route (meta, data, etc.), but the test mocks were using the
old handleMetadata/handleData methods that no longer exist in the code
path. Updated the mock to include dispatch and aligned test assertions
with the unified catch-all pattern used by all other adapters (hono, etc.).

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/d30145f6-3528-4e58-baf1-5011e72f43c4
Copilot AI changed the title [WIP] Fix all CI errors fix: align sveltekit adapter tests with dispatch() catch-all pattern Mar 21, 2026
Copilot AI requested a review from hotlong March 21, 2026 08:22
@hotlong hotlong marked this pull request as ready for review March 21, 2026 08:31
Copilot AI review requested due to automatic review settings March 21, 2026 08:31
@github-actions github-actions bot added documentation Improvements or additions to documentation tests size/s labels Mar 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the SvelteKit adapter test suite to match the adapter’s current unified routing approach, where non-auth/graphql/storage/discovery routes are handled via HttpDispatcher.dispatch() (consistent with other adapters).

Changes:

  • Updated the SvelteKit adapter test mock to implement dispatch() (removing obsolete handleMetadata/handleData mocks).
  • Adjusted Metadata/Data/Error handling/toResponse tests to assert the dispatch(method, path, body, query, context) catch-all contract.
  • Documented the fix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/adapters/sveltekit/src/sveltekit.test.ts Aligns the mocked dispatcher + assertions with the adapter’s catch-all dispatch() behavior.
CHANGELOG.md Records the SvelteKit adapter test alignment/fix under “Fixed”.

@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot ci test 还是报错,我要解决所有问题

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/b4107236-dbb5-4f8e-8fda-054f241adfe7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m size/s tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants