Initial commit
This commit is contained in:
19
tests/helpers/apiHelpers.test.js
Normal file
19
tests/helpers/apiHelpers.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user