From 00f6031fbf5dcf395f68b6941e3481084b5acd1f Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 8 Jul 2020 11:47:01 -0400 Subject: [PATCH] test: assert vnode invalid key warning for NaN --- packages/runtime-core/__tests__/vnode.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/__tests__/vnode.spec.ts b/packages/runtime-core/__tests__/vnode.spec.ts index fbab2604..4e6c207b 100644 --- a/packages/runtime-core/__tests__/vnode.spec.ts +++ b/packages/runtime-core/__tests__/vnode.spec.ts @@ -11,12 +11,14 @@ import { transformVNodeArgs } from '../src/vnode' import { Data } from '../src/component' -import { ShapeFlags, PatchFlags } from '@vue/shared' +import { ShapeFlags, PatchFlags, mockWarn } from '@vue/shared' import { h, reactive, isReactive } from '../src' import { createApp, nodeOps, serializeInner } from '@vue/runtime-test' import { setCurrentRenderingInstance } from '../src/componentRenderUtils' describe('vnode', () => { + mockWarn() + test('create with just tag', () => { const vnode = createVNode('p') expect(vnode.type).toBe('p') @@ -62,6 +64,7 @@ describe('vnode', () => { } expect(createVNode('div').key).toBe(null) expect(createVNode('div', { key: undefined }).key).toBe(null) + expect(`VNode created with invalid key (NaN)`).toHaveBeenWarned() }) test('create with class component', () => {