Skip to content

Commit

Permalink
test: add more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 10, 2025
1 parent a5acb4a commit e1c5980
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/runtime-vapor/__tests__/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,26 @@ describe('component', () => {
expect(host.innerHTML).toBe('')
expect(i.scope.effects.length).toBe(0)
})

it('warn if functional vapor component not return a block', () => {
define(() => {
return () => {}
}).render()

expect(
'Functional vapor component must return a block directly',
).toHaveBeenWarned()
})

it('warn if setup return a function and no render function', () => {
define({
setup() {
return () => []
},
}).render()

expect(
'Vapor component setup() returned non-block value, and has no render function',
).toHaveBeenWarned()
})
})

0 comments on commit e1c5980

Please sign in to comment.