Update tests and bugfix

pull/10616/head
Andrew Watkins 2018-04-10 14:26:21 -07:00
parent 6fec8ecd91
commit 10b9fdf507
2 changed files with 2 additions and 4 deletions

View File

@ -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) {

View File

@ -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()
})
})