소스 검색

test(runtime-core): show warn when create with invalid type (#2128)

edison 5 년 전
부모
커밋
1cc8cd60a1
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      packages/runtime-core/__tests__/vnode.spec.ts

+ 6 - 0
packages/runtime-core/__tests__/vnode.spec.ts

@@ -42,6 +42,12 @@ describe('vnode', () => {
     expect(vnode.props).toBe(null)
   })
 
+  test('show warn when create with invalid type', () => {
+    const vnode = createVNode('')
+    expect('Invalid vnode type when creating vnode').toHaveBeenWarned()
+    expect(vnode.type).toBe(Comment)
+  })
+
   test('create from an existing vnode', () => {
     const vnode1 = createVNode('p', { id: 'foo' })
     const vnode2 = createVNode(vnode1, { class: 'bar' }, 'baz')