From e7742dac919b36f8e654f42bf97d444c25cb46a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 31 Mar 2023 02:51:38 +0800 Subject: [PATCH] test: improve --- .../__snapshots__/compileScript.spec.ts.snap | 18 ++--- .../__tests__/compileScript.spec.ts | 65 ++++++++++--------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index c4cec4779bd..ee00977c131 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -1785,45 +1785,45 @@ return { props, emit } })" `; -exports[`SFC compile - `) - assertCode(content) - expect(content).toMatch(`const slots = _useSlots()`) - }) + describe('defineSlots()', () => { + test('basic usage', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).toMatch(`const slots = _useSlots()`) + expect(content).not.toMatch('defineSlots') + }) - test('defineSlots w/o return value', () => { - const { content } = compile(` - - `) - assertCode(content) - expect(content).not.toMatch(`_useSlots`) - }) + test('w/o return value', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).not.toMatch('defineSlots') + expect(content).not.toMatch(`_useSlots`) + }) - test('defineSlots w/o generic params', () => { - const { content } = compile(` - - `) - assertCode(content) - expect(content).toMatch(`const slots = _useSlots()`) + test('w/o generic params', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).toMatch(`const slots = _useSlots()`) + expect(content).not.toMatch('defineSlots') + }) }) test('runtime Enum', () => {