From bc04592ca9471e1685bd73e0429cc7cc98b54f29 Mon Sep 17 00:00:00 2001 From: XiaoDong Date: Tue, 18 Jun 2024 00:22:56 +0800 Subject: [PATCH] test(runtime-vapor): add unit test for config.performance (#234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- .../__tests__/apiCreateVaporApp.spec.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts b/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts index f783ef33a..9109d5b87 100644 --- a/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts +++ b/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts @@ -310,4 +310,26 @@ describe('api: createVaporApp', () => { ).toHaveBeenWarned() }) }) + + describe('config.performance', () => { + afterEach(() => { + window.performance.clearMeasures() + }) + + test('with performance enabled', () => { + const { app, mount } = define({}).create() + + app.config.performance = true + mount() + expect(window.performance.getEntries()).lengthOf(2) + }) + + test('with performance disabled', () => { + const { app, mount } = define({}).create() + + app.config.performance = false + mount() + expect(window.performance.getEntries()).lengthOf(0) + }) + }) })