Update tests and bugfix
parent
6fec8ecd91
commit
10b9fdf507
|
@ -183,7 +183,6 @@ export class TickscriptPage extends PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
if (response.code === 422) {
|
||||
router.push(`/sources/${sourceID}/tickscript/new`)
|
||||
this.setState({unsavedChanges: true, consoleMessage: response.message})
|
||||
return
|
||||
} else if (response.code) {
|
||||
|
|
|
@ -83,7 +83,7 @@ describe('Kapacitor.Containers.TickscriptPage', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('routes the user to Tickscript /new page if save fails', done => {
|
||||
it('keeps the user on /new if save fails', done => {
|
||||
const push = jest.fn()
|
||||
const createTask = jest.fn(() =>
|
||||
Promise.resolve({code: 422, message: 'invalid tickscript'})
|
||||
|
@ -106,8 +106,7 @@ describe('Kapacitor.Containers.TickscriptPage', () => {
|
|||
save.dive().simulate('click')
|
||||
|
||||
process.nextTick(() => {
|
||||
expect(push).toHaveBeenCalledTimes(1)
|
||||
expect(push.mock.calls[0][0]).toMatch('new')
|
||||
expect(push).not.toHaveBeenCalled()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue