Created
January 16, 2023 19:20
-
-
Save Attaulla9/fb27933a7da3b85f3b8d17ac2319c52f to your computer and use it in GitHub Desktop.
Vue test standard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest' | |
import { shallowMount } from '@vue/test-utils' | |
import App from '@/App.vue' // Import Vue component to test | |
import axios from 'axios' // Import libraries to mock | |
// Mock the axios library | |
vi.mock("axios", () => { | |
return { | |
default: { | |
get: vi.fn(), | |
}, | |
}; | |
}); | |
describe('Tests for the ... Component', () => { | |
let wrapper = null | |
beforeEach(() => { | |
// set any initial data and create the mocks of libraries | |
// render the component | |
wrapper = shallowMount(App) | |
}) | |
afterEach(() => { | |
axios.get.mockReset() | |
wrapper.unmount() | |
}) | |
it('check successful events', () => { ... }) | |
it('check failure events', () => { ... }) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment