Skip to content

test(countdown): improve test coverage#1997

Open
aioya wants to merge 1 commit into
varletjs:devfrom
aioya:test/countdown-coverage
Open

test(countdown): improve test coverage#1997
aioya wants to merge 1 commit into
varletjs:devfrom
aioya:test/countdown-coverage

Conversation

@aioya

@aioya aioya commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Checklist

List of tasks you have already done and plan to do.

  • Fix linting errors
  • Tests have been added / updated (or snapshots)

Change information

Improve unit test coverage for the countdown component. Pure test additions, no behavior changes.

Issues

N/A

Related Links

N/A

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@aioya is attempting to deploy a commit to the varletjs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@varlet/cli

npm i https://pkg.pr.new/@varlet/cli@1997

@varlet/icons

npm i https://pkg.pr.new/@varlet/icons@1997

@varlet/import-resolver

npm i https://pkg.pr.new/@varlet/import-resolver@1997

@varlet/preset-tailwindcss

npm i https://pkg.pr.new/@varlet/preset-tailwindcss@1997

@varlet/preset-unocss

npm i https://pkg.pr.new/@varlet/preset-unocss@1997

@varlet/shared

npm i https://pkg.pr.new/@varlet/shared@1997

@varlet/touch-emulator

npm i https://pkg.pr.new/@varlet/touch-emulator@1997

@varlet/ui

npm i https://pkg.pr.new/@varlet/ui@1997

@varlet/use

npm i https://pkg.pr.new/@varlet/use@1997

@varlet/vite-plugins

npm i https://pkg.pr.new/@varlet/vite-plugins@1997

commit: 6bb93a6

@aioya aioya self-assigned this Jun 22, 2026
Comment on lines +202 to +210
const wrapper = mount(Wrapper)
await delay(0)

wrapper.vm.$refs.countdown.start()
wrapper.vm.$refs.countdown.start()

await delay(50)

wrapper.unmount()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这种 case 感觉用处不大,最好是能整体 review 一下所有的测试 pr。

@aioya aioya force-pushed the test/countdown-coverage branch from 32d2b40 to 6bb93a6 Compare June 23, 2026 02:47
@aioya

aioya commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Removed every test() that had neither an assertion nor a snapshot, keeping only tests that verify expected behavior. The affected open PRs (#1994, #1995, this one) have been updated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves unit test coverage for the countdown component by adding new test cases around time-prop changes, millisecond formatting tokens, KeepAlive pause/resume behavior, and restart behavior after reaching zero.

Changes:

  • Added tests verifying restart behavior when time prop changes (with/without autoStart).
  • Added tests for S/SS/SSS millisecond formatting and KeepAlive deactivation/activation behavior.
  • Added a test ensuring start() after reaching 0 restarts from the full time prop.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1 to +3
import { mount } from '@vue/test-utils'
import { describe, expect, test, vi } from 'vite-plus/test'
import { createApp } from 'vue'
import { createApp, defineComponent, KeepAlive } from 'vue'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

?

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.

3 participants