Skip to content

fix(test): give the image-insert store fakes an open-files list - #25357

Merged
Jinwoo-H merged 1 commit into
mainfrom
fix/editor-image-insert-merge-collision
Oct 5, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
fix/editor-image-insert-merge-collision

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15
Prod 0 0 0 0

ELI5

Main's editor tests are red (38 failures). #24489 made image insert look up the open file to decide document-folder access; #25176's new tests fake the app store without an open-files list, so that lookup throws inside the tests and nothing gets inserted. This adds the missing empty list to the three test fakes.

What Changed

Test-only: openFiles: [] added to the store fakes in rich-markdown-async-image-paste.test.ts, rich-markdown-async-image-table.test.ts and useLocalImagePick.test.tsx. No product code changes; the real store always has openFiles.

Why

The two PRs merged cleanly in source but their tests collided, so every open PR's CI fails on these editor tests.

Linked Issue

Maintainer PR; fixes main's red editor tests after #24489 and #25176.

Visual Proof

N/A: test-only change.

Testing

  • src/renderer/src/components/editor: 307 files / 2298 tests pass (38 failures on main before).

  • pnpm run typecheck, oxlint and check:code-quality:changed pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

#25176 and #24489 landed together and collided in
insertRichMarkdownImageFromPath. #25176 added three test files whose
@/store mock returns { settings, folderWorkspaces, worktreesByRepo }.
#24489 made the same function look up the open document with
state.openFiles.find(...) to pass document-folder access to the import.
Under the mock, openFiles is undefined, so the lookup throws, the catch
shows "Failed to insert image", and no image is inserted -- 38 tests
fail on main.

The real store always carries openFiles, so production behavior of both
PRs is intact; the mocks were just written against the pre-#24489 shape.
Add openFiles: [] to the three mocks.
@Jinwoo-H
Jinwoo-H merged commit d9846e6 into main Oct 5, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant