Skip to content

Add focused confirmPaste coverage for clipboard validation and modal handoff#1473

Merged
marcuscastelo merged 4 commits into
rc/v0.16.0from
copilot/add-tests-confirm-paste-use-case
Mar 25, 2026
Merged

Add focused confirmPaste coverage for clipboard validation and modal handoff#1473
marcuscastelo merged 4 commits into
rc/v0.16.0from
copilot/add-tests-confirm-paste-use-case

Conversation

Copilot AI commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

confirmPaste had no test coverage despite being a user-facing clipboard entry point that validates payloads, shows errors, and routes into the paste confirmation flow. This change adds focused coverage for the success and failure paths that matter to paste behavior.

  • Clipboard use-case coverage

    • Adds a dedicated test suite for createClipboardUseCases().confirmPaste
    • Verifies valid clipboard data is accepted and routed to the confirmation flow
    • Verifies empty clipboard state does not proceed and surfaces the expected error path
    • Verifies schema mismatch is rejected and does not open the modal path
  • UI handoff verification

    • Mocks openPasteConfirmModal at the module boundary
    • Asserts the modal is opened with the parsed payload and the original confirmation callback
    • Confirms the callback ultimately receives the expected payload on the valid path
  • Error-path assertions

    • Locks in the current incompatibility handling for invalid clipboard payloads
    • Ensures invalid data never reaches the paste handler
useCases.confirmPaste(itemSchema, onPasteConfirmed)

expect(openPasteConfirmModal).toHaveBeenCalledWith(payload, onPasteConfirmed)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • test.supabase.co
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js user.email /usr/local/sbin/bash (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>The confirmPaste use case lacks test coverage. This is a critical user-facing function that validates clipboard data and shows error messages. Add tests to verify:</issue_title>
<issue_description>reportedBy: github-copilot.v1/refine-github-issue

Task: Add tests for confirmPaste use-case (clipboard paste validation)

Title:
Add unit/integration tests for confirmPaste clipboard use-case

Description:
confirmPaste validates clipboard data, handles errors, and may open modals or show error messages. It currently lacks test coverage. Add tests that cover success and error paths, and verify UI interactions when appropriate.

Motivation:
confirmPaste is user-facing and critical for clipboard flows. Tests will prevent regressions and ensure error states are handled gracefully.

Acceptance Criteria:

  • Test successful paste with valid payload: validation passes and expected handler is invoked (modal opened or payload processed).
  • Test when clipboard is empty: correct error handling (toast/modal) and no modal open.
  • Test schema validation failure: correct error handling and messages shown.
  • Test that, on valid payload, the modal opens (or the expected UI path is followed) with the correct payload passed to the handler.
  • Add necessary test utilities/mocks for clipboard and UI interactions.

Files / Scope:

  • Tests should live near other clipboard use-case tests or in the relevant use-cases test suite.
  • May require mocking clipboardUseCases and UI modal utilities.

Additional Context:

  • Use existing test helpers and patterns used across the codebase for UI/modal assertions.
    </issue_description>

<agent_instructions>pnpm check always green</agent_instructions>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@vercel

vercel Bot commented Mar 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
macroflows Ready Ready Preview, Comment Mar 25, 2026 0:44am

Co-authored-by: marcuscastelo <27441558+marcuscastelo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/marcuscastelo/macroflows/sessions/f300a3f2-84e4-41f8-8474-fe0ef356c507
Co-authored-by: marcuscastelo <27441558+marcuscastelo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/marcuscastelo/macroflows/sessions/f300a3f2-84e4-41f8-8474-fe0ef356c507
Copilot AI changed the title [WIP] Add tests for confirmPaste clipboard use-case Add focused confirmPaste coverage for clipboard validation and modal handoff Mar 24, 2026
Copilot AI requested a review from marcuscastelo March 24, 2026 21:43
@marcuscastelo marcuscastelo marked this pull request as ready for review March 24, 2026 21:47
Copilot AI review requested due to automatic review settings March 24, 2026 21:47

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

Adds targeted Vitest coverage for the clipboard confirmPaste use-case to prevent regressions in paste validation and modal handoff behavior.

Changes:

  • Introduces a dedicated clipboardUseCases.confirmPaste test suite covering success, empty clipboard, and schema mismatch paths.
  • Mocks openPasteConfirmModal at the module boundary and asserts correct arguments/handler wiring.
  • Asserts the expected showError calls for invalid/empty clipboard scenarios.

Comment thread src/modules/clipboard/application/usecases/tests/clipboardUseCases.test.ts Outdated
@marcuscastelo marcuscastelo merged commit 630d37c into rc/v0.16.0 Mar 25, 2026
5 checks passed
@marcuscastelo marcuscastelo deleted the copilot/add-tests-confirm-paste-use-case branch March 25, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants