Invariant Violation: An error occurred on Quasar using Jest

16 Views Asked by At

And I get the following error: ● Test suite failed to run

Invariant Violation: An error occurred! 

  21 |   `URI for Apollo Client: ${apiUrl().proto}//${apiUrl().url}registrado/`,
  22 | );

23 | const httpAuthLink = new HttpLink({ | ^ 24 | uri: ${apiUrl().proto}//${apiUrl().url}registrado/, 25 | }); 26 | const httpDefaultLink = new HttpLink({

Hello everyone, dear friends!!! I am conducting a test for the presence of objects on the authorization page in the project on Quasar using Jest. For example, in the mainLayout file.vue I need to check for the presence of two objects "Universo" and "Input". Here I am doing a test to find these objects:

import Quasar from 'quasar';
import mainLayout from '../../../src/layouts/mainLayout.vue';
import { describe, it, expect, jest, beforeEach } from '@jest/globals';

describe('MainLayout', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = mount(MainLayout, {
      global: {
        plugins: [Quasar],
      },
    });
  });

  it('should find the Universo q-item with an image', () => {
    const universoItem = wrapper.find('.q-item-section:contains("Universo")');
    expect(universoItem.exists()).toBe(true);
    const image = universoItem.find('img');
    expect(image.exists()).toBe(true);
  });

  it('should find the Entrance q-item', () => {
const entranceItem = wrapper.find('.q-item-section:contains("Entrance")');
    expect(entranceItem.exists()).toBe(true);
  });
});

I understand that the problem is with Pinia, which continues to work with Apollo. This error also appears on other tests. You can tell me and direct me in which direction to work to solve this problem.

0

There are 0 best solutions below