Skip to content

test: unit tests for RunningClockDatePicker - #3300

Merged
ericleponner merged 2 commits into
mainfrom
3237-running-clock-date-picker-unit-test
Aug 19, 2026
Merged

test: unit tests for RunningClockDatePicker#3300
ericleponner merged 2 commits into
mainfrom
3237-running-clock-date-picker-unit-test

Conversation

@jbair06

@jbair06 jbair06 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Description:
Adds a Vitest renderer unit test suite for RunningClockDatePicker (the valid-start time picker in the transaction form). Uses vi.useFakeTimers() / vi.advanceTimersByTime() to verify the component automatically tracks the system clock, pauses updates while the picker menu is open, buffers user edits until close, and clears its interval on unmount. See the issue for the full test-case specification.

Related issue(s):

Fixes #3237

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@jbair06
jbair06 requested a review from a team as a code owner August 18, 2026 23:19
@jbair06
jbair06 requested a review from steven-sheehy August 18, 2026 23:19
@jbair06 jbair06 added this to the v0.38.0 milestone Aug 18, 2026
@jbair06 jbair06 added the Frontend Frontend development work label Aug 18, 2026
@jbair06 jbair06 self-assigned this Aug 18, 2026
@swirlds-automation

swirlds-automation commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.98%. Comparing base (9303a1f) to head (e8ded34).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3300   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         192      192           
  Lines        6191     6191           
  Branches     1159     1159           
=======================================
  Hits         6190     6190           
  Misses          1        1           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 a renderer-unit test suite for RunningClockDatePicker to verify its “track system clock / pause while open / buffer edits / cleanup on unmount” behavior. The PR also removes backend delete endpoints and associated service logic for transactions and transaction groups, which is not described in the PR metadata or the linked issue.

Changes:

  • Add Vitest (happy-dom) unit tests for RunningClockDatePicker, including fake-timer interval behavior and open/close buffering semantics.
  • Remove removeTransaction and the DELETE /transactions/:id controller endpoint, along with corresponding unit tests.
  • Remove removeTransactionGroup and the DELETE /transaction-groups/:id controller endpoint, along with corresponding unit tests and imports.

Reviewed changes

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

Show a summary per file
File Description
front-end/src/tests/renderer/components/RunningClockDatePicker.spec.ts New fake-timer unit tests covering RunningClockDatePicker ticking, pause/resume, buffering, and unmount cleanup behavior.
back-end/apps/api/src/transactions/transactions.service.ts Removes removeTransaction service method.
back-end/apps/api/src/transactions/transactions.service.spec.ts Removes unit tests for removeTransaction.
back-end/apps/api/src/transactions/transactions.controller.ts Removes the DELETE /transactions/:id endpoint.
back-end/apps/api/src/transactions/transactions.controller.spec.ts Removes controller tests for deleting transactions.
back-end/apps/api/src/transactions/groups/transaction-groups.service.ts Removes removeTransactionGroup service method (and related import).
back-end/apps/api/src/transactions/groups/transaction-groups.service.spec.ts Removes unit tests and import for transaction-group deletion behavior.
back-end/apps/api/src/transactions/groups/transaction-groups.controller.ts Removes the DELETE /transaction-groups/:id endpoint.
back-end/apps/api/src/transactions/groups/transaction-groups.controller.spec.ts Removes controller tests for removing a transaction group.
Suppressed comments (1)

back-end/apps/api/src/transactions/transactions.service.ts:865

  • This PR removes the TransactionsService.removeTransaction() method (and related behavior/notifications), but the PR title/description and linked issue (#3237) describe only adding front-end unit tests. If these backend API changes are intentional, the PR description/title (and possibly the linked issue) should be updated to reflect the breaking API/service change, or the backend removal should be split into a separate PR.
    return Array.from(results.values());
  }

  /* Cancel the transaction if the valid start has not come yet. */
  async cancelTransaction(id: number, user: User): Promise<boolean> {
    await this.cancelTransactionWithOutcome(id, user);
    return true;
  }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread back-end/apps/api/src/transactions/transactions.controller.ts
Comment thread front-end/src/tests/renderer/components/RunningClockDatePicker.spec.ts Outdated
Covers issue #3237 (manual test 7.1.7): verifies the valid-start time
picker tracks the system clock via setInterval, pauses while the menu is
open, buffers user edits, and cleans up on unmount.

Signed-off-by: John Bair <john.bair@swirldslabs.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jbair06
jbair06 force-pushed the 3237-running-clock-date-picker-unit-test branch from 03fa988 to 269833c Compare August 19, 2026 00:08
Signed-off-by: John Bair <john.bair@swirldslabs.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

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

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

Suppressed comments (1)

front-end/src/tests/renderer/components/RunningClockDatePicker.spec.ts:181

  • Asserting vi.getTimerCount() === 0 after unmount is brittle because unrelated timers (from Vue Test Utils / happy-dom / other stubs) can exist even if this component cleared its own interval. Consider capturing the initial timer count before mount and asserting it returns to that baseline after wrapper.unmount(), or spy on setInterval/clearInterval to ensure the created interval is cleared.
    // At least one interval must be running while the component is mounted.
    expect(vi.getTimerCount()).toBeGreaterThanOrEqual(1);

    wrapper.unmount();

    // After unmount the interval must be cleared — no pending timers remain.
    expect(vi.getTimerCount()).toBe(0);

@ericleponner ericleponner 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.

LGTM

@ericleponner
ericleponner merged commit 102236d into main Aug 19, 2026
29 checks passed
@ericleponner
ericleponner deleted the 3237-running-clock-date-picker-unit-test branch August 19, 2026 06:51
@steven-sheehy steven-sheehy added the Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible. label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible. Frontend Frontend development work Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add valid start time picker unit test (7.1.7)

5 participants