22 lines
747 B
JavaScript
22 lines
747 B
JavaScript
import {describe, test, expect, vi} from 'vitest'
|
|
import AdapterOfMachines from "@adapters/AdapterOfMachines.js"
|
|
import axios from 'axios'
|
|
import {apiModalListMachines, appModalListMachines} from "@mocks/machines.js"
|
|
|
|
vi.mock('axios')
|
|
|
|
|
|
describe('AdapterOfMachines', () => {
|
|
axios.post.mockResolvedValue({data: apiModalListMachines})
|
|
|
|
test('AdapterOfMachines should be a object', () => {
|
|
const adapterOfMachines = new AdapterOfMachines('')
|
|
expect(typeof adapterOfMachines).toBe('object')
|
|
})
|
|
|
|
test('test of fetchMachines', async () => {
|
|
const adapterOfMachines = new AdapterOfMachines('http://localhost:5444')
|
|
const result = await adapterOfMachines.getModalMachines()
|
|
expect(result).toEqual(appModalListMachines)
|
|
})
|
|
}) |