20 lines
637 B
JavaScript
20 lines
637 B
JavaScript
import axios from 'axios'
|
|
import {describe, test, expect, vi} from 'vitest'
|
|
import {apiModalListMachines} from "@mocks/machines.js"
|
|
import {scandApiRequest} from "@helpers/apiHelpers.js"
|
|
|
|
vi.mock('axios')
|
|
|
|
describe('scandApiRequest', () => {
|
|
test('scandApiRequest should be a function', () => {
|
|
expect(typeof scandApiRequest).toBe('function')
|
|
})
|
|
|
|
test('scandApiRequest should return a promise', async () => {
|
|
axios.post.mockResolvedValue({data: apiModalListMachines})
|
|
const result = await scandApiRequest('ScandApi.LiveMonitor.Machines', 'select_machines', [])
|
|
expect(result).toEqual(apiModalListMachines)
|
|
})
|
|
})
|
|
|