test(runtime-vapor): add unit test for config.performance (#234)

Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
This commit is contained in:
XiaoDong 2024-06-18 00:22:56 +08:00 committed by GitHub
parent 80acfa5030
commit bc04592ca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -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)
})
})
})