Skip to content

Commit

Permalink
chore: NIP
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Aug 14, 2024
1 parent dcaa7cf commit 476f01c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
4 changes: 1 addition & 3 deletions tests/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import {
watchEffect,
useWatchEffect,
useReactivity,
batchedUpdates,
} from '../src'

test('<exports> should be export all @vue/reactivity members', () => {
expect(
Object.keys(vueReactivity).every((key) => {
const targetMember = (veact as any)[key]
return Boolean(targetMember) && (vueReactivity as any)[key] === targetMember
})
}),
).toBeTruthy()
})

Expand All @@ -42,7 +41,6 @@ test('<type> should be function type', () => {
expect(typeof watchEffect).toBe(hooksTargetType)
expect(typeof useWatchEffect).toBe(hooksTargetType)
expect(typeof useReactivity).toBe(hooksTargetType)
expect(typeof batchedUpdates).toBe(hooksTargetType)
})

test('<lifecycle>', () => {
Expand Down
20 changes: 6 additions & 14 deletions tests/watch.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { renderHook, act } from '@testing-library/react-hooks'
import {
ref,
reactive,
watch,
useRef,
useWatch,
watchEffect,
useWatchEffect,
} from '../src'
import { ref, reactive, watch, useRef, useWatch, watchEffect, useWatchEffect } from '../src'

test('<watchEffect> ref & onInvalidate', () => {
const logs: any[] = []
Expand Down Expand Up @@ -56,7 +48,7 @@ test('<watch> function ref', () => {
const data = ref(3)
watch(
() => data.value,
(value) => logs.push(value)
(value) => logs.push(value),
)

expect(logs.length).toBe(0)
Expand All @@ -72,7 +64,7 @@ test('<watch> array function ref', () => {
const data = ref(3)
watch(
() => [data.value],
([value]) => logs.push(value)
([value]) => logs.push(value),
)

expect(logs.length).toBe(0)
Expand Down Expand Up @@ -119,7 +111,7 @@ test('<watch> function reactive cloneDeep', () => {
(newData, oldData) => {
isEqual = newData === oldData
logs.push(newData)
}
},
)

expect(logs.length).toBe(0)
Expand All @@ -142,7 +134,7 @@ test('<watch> function reactive deep', () => {
},
{
deep: true,
}
},
)

expect(logs.length).toBe(0)
Expand All @@ -159,7 +151,7 @@ test('<watch> function array mixin', () => {
const reactiveData = reactive({ value: false })
watch(
() => [refData.value, reactiveData.value] as const,
(newData) => logs.push(...newData)
(newData) => logs.push(...newData),
)

expect(logs.length).toBe(0)
Expand Down

0 comments on commit 476f01c

Please sign in to comment.