test: coverage

This commit is contained in:
Evan You
2019-08-27 14:42:05 -04:00
parent 7ecdc79d5e
commit 62e07a1b7e
5 changed files with 40 additions and 13 deletions

View File

@@ -258,4 +258,29 @@ describe('api: provide/inject', () => {
await nextTick()
expect(serialize(root)).toBe(`<div>2</div>`)
})
it('should warn unfound', () => {
const Provider = {
setup() {
return () => h(Middle)
}
}
const Middle = {
render: () => h(Consumer)
}
const Consumer = {
setup() {
const foo = inject('foo')
expect(foo).toBeUndefined()
return () => foo
}
}
const root = nodeOps.createElement('div')
render(h(Provider), root)
expect(serialize(root)).toBe(`<div><!----></div>`)
expect(`injection "foo" not found.`).toHaveBeenWarned()
})
})