Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(reactivity): improve typing #10155

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

zqran
Copy link
Contributor

@zqran zqran commented Jan 19, 2024

This PR makes the following changes to the reactivity test code:

  1. Simplified Arrow function and the format is unified
  2. Removed unnecessary any type
  3. Removed some redundant test code

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB 34.4 kB 30.9 kB
vue.global.prod.js 147 kB 53.6 kB 47.8 kB

Usages

Name Size Gzip Brotli
createApp 50.3 kB 19.7 kB 18 kB
createSSRApp 53.7 kB 21 kB 19.1 kB
defineCustomElement 52.6 kB 20.4 kB 18.6 kB
overall 64 kB 24.8 kB 22.5 kB

@haoqunjiang haoqunjiang added the 🧹 p1-chore Priority 1: this doesn't change code behavior. label Feb 29, 2024
@@ -241,7 +241,6 @@ describe('reactivity/ref', () => {
expect(isRef(computed(() => 1))).toBe(true)

expect(isRef(0)).toBe(false)
expect(isRef(1)).toBe(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be removed. Testing isRef with a truthy primitive value seems like a valid test case.

@@ -339,7 +331,6 @@ describe('reactivity/computed', () => {
_msg = msg.value
})

items.value = [1, 2, 3]
Copy link
Contributor

Choose a reason for hiding this comment

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

This extra assignment is part of what is being tested in this edge case. The test may pass either way, but it needs this line to test the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior. wait changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants