15 lines
786 B
JavaScript
15 lines
786 B
JavaScript
import request from '@/utils/request'
|
|
import { acknowledgeAlert, closeAlert, getAlertLifecycle } from '@/api/bell/alert-lifecycle'
|
|
jest.mock('@/utils/request', () => jest.fn(config => Promise.resolve(config)))
|
|
describe('Bell alert lifecycle API', () => {
|
|
beforeEach(() => request.mockClear())
|
|
it('maps timeline, ack and close to protected Alert routes', async() => {
|
|
await getAlertLifecycle('a1'); await acknowledgeAlert('a1'); await closeAlert('a1', { outcome: 'site_normal' })
|
|
expect(request.mock.calls.map(call => call[0])).toEqual([
|
|
{ url: '/api/v1/bell/alerts/a1/lifecycle', method: 'get' },
|
|
{ url: '/api/v1/bell/alerts/a1/ack', method: 'post' },
|
|
{ url: '/api/v1/bell/alerts/a1/close', method: 'post', data: { outcome: 'site_normal' }}
|
|
])
|
|
})
|
|
})
|