mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
test: refactor
This commit is contained in:
parent
0214f703fa
commit
4dad40c127
@ -191,7 +191,7 @@ describe('runtime server component', () => {
|
||||
expect(fetch).toHaveBeenCalledOnce()
|
||||
expect(wrapper.html()).toMatchInlineSnapshot('"<div>1</div>"')
|
||||
|
||||
expect(Object.keys(useNuxtApp().payload.data).length).toBeGreaterThan(0)
|
||||
expect(Object.keys(useNuxtApp().payload.data).length).toBe(1)
|
||||
})
|
||||
|
||||
it('expect server component to NOT set the response into the payload', async () => {
|
||||
@ -209,29 +209,6 @@ describe('runtime server component', () => {
|
||||
expect(fetch).toHaveBeenCalledOnce()
|
||||
expect(wrapper.html()).toMatchInlineSnapshot('"<div>1</div>"')
|
||||
expect(Object.keys(useNuxtApp().payload.data).length).toBe(0)
|
||||
await wrapper.setProps({
|
||||
useCache: false,
|
||||
setCache: false,
|
||||
props: {
|
||||
test: 2
|
||||
}
|
||||
})
|
||||
|
||||
await flushPromises()
|
||||
expect(fetch).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper.html()).toMatchInlineSnapshot('"<div>2</div>"')
|
||||
expect(Object.keys(useNuxtApp().payload.data).length).toBe(0)
|
||||
await wrapper.setProps({
|
||||
useCache: false,
|
||||
setCache: false,
|
||||
props: {
|
||||
test: 2
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
expect(fetch).toHaveBeenCalledTimes(3)
|
||||
expect(wrapper.html()).toMatchInlineSnapshot('"<div>3</div>"')
|
||||
expect(Object.keys(useNuxtApp().payload.data).length).toBe(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user