import { mount} from '@vue/test-utils' import { expect, test, describe, vi } from 'vitest' import App from '@/App.vue'; import { createStore } from 'vuex' import {store as proxy} from '@/store/modules/proxy'; import axios from "axios"; vi.mock('axios') describe("tests App mounted with vuex", () => { const store = createStore({ global: { stubs: { } }, plugins: [], modules: { proxy }, }) axios.get.mockResolvedValue({ data: [ { "id": 1, "created_at": "2024-02-22T17:08:37.715772388+03:00", "updated_at": "2024-02-26T14:11:38.64094899+03:00", "deleted_at": null, "name": "jsonplaceholder.typicode.com", "port": 9965, "proxy_ip": "172.25.78.153", "site_ip": "172.25.78.153", "internet_uri": "localhost", "description": "localhost", "is_online": true }, { "id": 2, "created_at": "0001-01-01T00:00:00Z", "updated_at": "2024-02-26T17:38:00.255479017+03:00", "deleted_at": null, "name": "new", "port": 3645, "proxy_ip": "172.25.78.151", "site_ip": "172.25.78.151", "internet_uri": "", "description": "create...", "is_online": true } ], }) test('tests App mounted with vuex', async () => { const wrapper = mount(App, { global: { plugins: [store] } }) expect(wrapper.text()).toContain('На главную') }) })