mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
17 lines
354 B
TypeScript
17 lines
354 B
TypeScript
import axios from 'axios'
|
|
|
|
vi.mock('axios')
|
|
|
|
test('mocked axios', async () => {
|
|
await axios.get('string')
|
|
|
|
expect(axios.get).toHaveBeenCalledWith('string')
|
|
expect(axios.post).toBeUndefined()
|
|
})
|
|
|
|
test('can get actual axios', async () => {
|
|
const ax = await vi.importActual<typeof axios>('axios')
|
|
|
|
expect(vi.isMockFunction(ax.get)).toBe(false)
|
|
})
|