Skip to content

fix(tests): update DatasetList tests to new fetch-mock API#37623

Merged
msyavuz merged 4 commits into
masterfrom
fix-missing-dataset-list-test-helper
Feb 3, 2026
Merged

fix(tests): update DatasetList tests to new fetch-mock API#37623
msyavuz merged 4 commits into
masterfrom
fix-missing-dataset-list-test-helper

Conversation

@sadpandajoe
Copy link
Copy Markdown
Member

Summary

Updates DatasetList test files to use the new fetch-mock v12 API, fixing TypeScript compilation errors.

#36681 added comprehensive RTL and integration tests for DatasetList using the fetch-mock v11 API. Subsequently, #36662 upgraded fetch-mock from v11.1.5 to v12.6.0, which introduced breaking API changes. This PR updates the DatasetList tests to use the new API.

Changes

API migrations (6 files, 318 insertions, 420 deletions):

Old API (v11) New API (v12)
fetchMock.reset() fetchMock.removeRoutes()
fetchMock.resetHistory() fetchMock.clearHistory()
fetchMock.restore() fetchMock.removeRoutes()
fetchMock.calls(filter) fetchMock.callHistory.calls(filter)
call[0] (url) call.url
call[1] (options) call.options
{ overwriteRoutes: true } removed (option no longer exists)
<QueryParamProvider> <QueryParamProvider adapter={ReactRouter5Adapter}>

Files modified:

  • DatasetList.testHelpers.tsx
  • DatasetList.test.tsx
  • DatasetList.behavior.test.tsx
  • DatasetList.listview.test.tsx
  • DatasetList.permissions.test.tsx
  • DatasetList.integration.test.tsx

Test plan

  • npm run build passes (TypeScript compilation)
  • Pre-commit hooks pass (type-checking, prettier, eslint, oxlint)
  • DatasetList tests pass

🤖 Generated with Claude Code

The fetch-mock library was upgraded and the API changed:
- fetchMock.reset() → fetchMock.removeRoutes()
- fetchMock.resetHistory() → fetchMock.clearHistory()
- fetchMock.restore() → fetchMock.removeRoutes()
- fetchMock.calls() → fetchMock.callHistory.calls()
- call[0] → call.url, call[1] → call.options
- { overwriteRoutes: true } option removed (no longer exists)
- QueryParamProvider now requires adapter prop

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dosubot dosubot Bot added the listview Namespace | Anything related to lists, such as Dashboards, Charts, Datasets, etc. label Feb 3, 2026
@sadpandajoe sadpandajoe requested a review from rusackas February 3, 2026 03:40
@sadpandajoe sadpandajoe added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Feb 3, 2026
Comment thread superset-frontend/src/pages/DatasetList/DatasetList.test.tsx Outdated
Comment thread superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx Outdated
Comment thread superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx Outdated
Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #c84c92

Actionable Suggestions - 2
  • superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx - 1
  • superset-frontend/src/pages/DatasetList/DatasetList.behavior.test.tsx - 1
Review Details
  • Files reviewed - 6 · Commit Range: e13418f..e13418f
    • superset-frontend/src/pages/DatasetList/DatasetList.behavior.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.integration.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.permissions.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx Outdated
Comment thread superset-frontend/src/pages/DatasetList/DatasetList.behavior.test.tsx Outdated
- Fix toast message access: use mock.calls[0][0] instead of mock.calls[0].url
  (Jest mock calls are arrays, not objects with url property)
- Fix unmatched calls detection: use calls('unmatched') instead of calls(false)
  (fetch-mock v12 API change)
- Add fetchMock.removeRoute() before per-test mocks in permissions tests
  (ensures test-specific mocks override setupMocks() defaults)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 3, 2026

Code Review Agent Run #1ad292

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: e13418f..a37b799
    • superset-frontend/src/pages/DatasetList/DatasetList.behavior.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.integration.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.permissions.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

sadpandajoe and others added 2 commits February 2, 2026 22:31
- Add fetchMock.removeRoute() before re-registering routes
- Add { name: ... } option to all route registrations for proper removal
- Remove unused setupApiPermissions function
- Fix PayloadMap type to use Record<string, string[]>
- Add DELETE_ROUTE_NAME constant for delete operation assertions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add removeRoute() + named routes to behavior test overrides.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 3, 2026

Code Review Agent Run #8dcdcf

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: a37b799..4abeecc
    • superset-frontend/src/pages/DatasetList/DatasetList.behavior.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.integration.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.permissions.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@msyavuz msyavuz merged commit 3a565a6 into master Feb 3, 2026
69 checks passed
@msyavuz msyavuz deleted the fix-missing-dataset-list-test-helper branch February 3, 2026 11:16
@michael-s-molina
Copy link
Copy Markdown
Member

Subsequently, #36662 upgraded fetch-mock from v11.1.5 to v12.6.0, which introduced breaking API changes.

@sadpandajoe @rusackas Do you know why CI didn't fail previously?

@hainenber
Copy link
Copy Markdown
Contributor

@michael-s-molina there wasn't any new tests with fetch-mock is my take :D

@sadpandajoe
Copy link
Copy Markdown
Member Author

Subsequently, #36662 upgraded fetch-mock from v11.1.5 to v12.6.0, which introduced breaking API changes.

@sadpandajoe @rusackas Do you know why CI didn't fail previously?

@michael-s-molina, @hainenber is correct that there were no tests that used the same fetch-mock calls that I had in #36681 as those calls were deprecated. The PR was working and since I didn't touch the original files, there were no conflicts. Pair that with the GHA outage post-merge, it was hard to have caught it right away. So I actually caught it a lot later when I noticed another branch I was working on failing.

aminghadersohi pushed a commit to aminghadersohi/superset that referenced this pull request Mar 5, 2026
)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
alex-poor pushed a commit to alex-poor/superset that referenced this pull request Mar 15, 2026
)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

listview Namespace | Anything related to lists, such as Dashboards, Charts, Datasets, etc. merge-if-green If approved and tests are green, please go ahead and merge it for me size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants