Skip to content

Commit a75fbd1

Browse files
committed
test: use-format-result
1 parent c20a8af commit a75fbd1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import useFormatResult from '..'
2+
3+
describe('useFormatResult', () => {
4+
it('should inject data ', () => {
5+
const name = useFormatResult({ name: 'vue-hooks-plus' }, data => {
6+
return data.name
7+
})
8+
9+
expect(name.value).toBe('vue-hooks-plus')
10+
})
11+
it('should formatResult work', () => {
12+
const name = useFormatResult({ name: 'vue-hooks-plus' }, data => {
13+
return `${data.name} good`
14+
})
15+
expect(name.value).toBe('vue-hooks-plus good')
16+
})
17+
18+
it('support undefined', () => {
19+
const name = useFormatResult({ name: 'vue-hooks-plus' }, () => {
20+
return undefined
21+
})
22+
expect(name.value).toBeUndefined()
23+
})
24+
25+
it('support null', () => {
26+
const name = useFormatResult({ name: 'vue-hooks-plus' }, () => {
27+
return null
28+
})
29+
expect(name.value).toBeNull()
30+
})
31+
})

0 commit comments

Comments
 (0)