Skip to content

Recommendations for testing with vue-test-utils? #28

Closed
@danielbachhuber

Description

@danielbachhuber

Hi,

Do you have any recommendations for how to test for paginated data with vue-test-utils?

My typical test looks like this:

it('mounts', async () => {
    expect.assertions(1);
    mock.onGet('/api-uri')
        .reply(200, JSON.stringify([
            firstItem,
            secondItem,
        ]), {'x-total-count': 2});
    wrapper = mount(
        Component,
        {
            localVue,
            router,
            store,
            mocks: {
                $route,
            },
            stubs: ['router-link', 'router-view']
        },
    );
    await flushPromises();
    await wrapper.vm.$nextTick();
});

However, the computed createInstance() seems stuck in the .loading state, even after I've flushed the promises and waited for a re-render.

Any ideas on what I might be doing wrong?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions