Skip to content

Comments

fix(test): changed test use unsaved changes prompt#35447

Merged
sadpandajoe merged 39 commits intoapache:masterfrom
SBIN2010:fix/test_useUnsavedChangesPrompt
Oct 2, 2025
Merged

fix(test): changed test use unsaved changes prompt#35447
sadpandajoe merged 39 commits intoapache:masterfrom
SBIN2010:fix/test_useUnsavedChangesPrompt

Conversation

@SBIN2010
Copy link
Contributor

@SBIN2010 SBIN2010 commented Oct 1, 2025

After adding PR #35307, linter checks do not pass

SUMMARY

This is what is corrected in this

testing guidelines

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

SBIN2010 and others added 30 commits October 22, 2024 23:07
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

I've completed my review and didn't find any issues.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link
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 #c65c3d

Actionable Suggestions - 1
  • superset-frontend/src/hooks/useUnsavedChangesPrompt/useUnsavedChangesPrompt.test.tsx - 1
Review Details
  • Files reviewed - 1 · Commit Range: 19151d1..b1897dd
    • superset-frontend/src/hooks/useUnsavedChangesPrompt/useUnsavedChangesPrompt.test.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 Default Agent 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


expect(result.current.showModal).toBe(false);
});
test('should not show modal initially', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Test isolation failure

The PR removes the describe block wrapper and converts tests to standalone test functions, but this creates a critical test isolation issue. All tests now share the same history instance and wrapper configuration, which can cause test pollution where state from one test affects subsequent tests. The history object accumulates navigation state across tests, and the shared wrapper component may retain state. This will lead to flaky tests and false positives/negatives in CI/CD pipelines. Add proper test isolation by reinitializing the history instance before each test using beforeEach.

Code suggestion
Check the AI-generated fix before applying
 -
 -const history = createMemoryHistory({
 -  initialEntries: ['/dashboard'],
 -});
 -
 +let history = createMemoryHistory({
 +  initialEntries: ['/dashboard'],
 +});
 +
 +beforeEach(() => {
 +  history = createMemoryHistory({ initialEntries: ['/dashboard'] });
 +});
 +

Code Review Run #c65c3d


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Member

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

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

Looks good to me with a small nit

Comment on lines +25 to +31
let history = createMemoryHistory({
initialEntries: ['/dashboard'],
});

beforeEach(() => {
history = createMemoryHistory({ initialEntries: ['/dashboard'] });
});
Copy link
Member

Choose a reason for hiding this comment

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

beforeEach should work on a flat structure as well right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, beforeEach works perfectly fine with a flat test structure.
It runs before each test - every test gets a fresh history instance

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but i don't quite understand this change still? If const was working before do we need this let and reassign in beforeEach?

@sadpandajoe sadpandajoe merged commit a7cc48d into apache:master Oct 2, 2025
74 of 75 checks passed
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.

3 participants