Commit 62ce60b4 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

#1

parent defbe7fe
Pipeline #5850 passed with stages
in 5 minutes and 25 seconds
...@@ -14,33 +14,40 @@ describe('TaskView', () => { ...@@ -14,33 +14,40 @@ describe('TaskView', () => {
vm = new Component().$mount() vm = new Component().$mount()
}) })
it('shows all SUBMITTED or FAILED tasks in store', () => { it('shows all SUBMITTED or FAILED tasks in store', done => {
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}) Promise.all([
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'SUCCESS'}) store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}),
store.dispatch('setTask', {taskID: 3, taskName: 'C', taskState: 'SUBMITTED'}) store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'SUCCESS'}),
store.dispatch('setTask', {taskID: 4, taskName: 'D', taskState: 'FAILURE'}) store.dispatch('setTask', {taskID: 3, taskName: 'C', taskState: 'SUBMITTED'}),
store.dispatch('setTask', {taskID: 5, taskName: 'E', taskState: 'YAY'}) store.dispatch('setTask', {taskID: 4, taskName: 'D', taskState: 'FAILURE'}),
store.dispatch('setTask', {taskID: 6, taskName: 'F', taskState: 'PENDING'}) store.dispatch('setTask', {taskID: 5, taskName: 'E', taskState: 'YAY'}),
Vue.nextTick(() => { store.dispatch('setTask', {taskID: 6, taskName: 'F', taskState: 'PENDING'})
expect(Object.keys(store.getters.tasks).length).toBe(6) ]).then(() => {
expect(Object.keys(vm.incompleteTasks).length).toBe(2) Vue.nextTick(() => {
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(3) expect(Object.keys(store.getters.tasks).length).toBe(6)
expect(vm.$el.querySelectorAll('.fjs-submitted').length).toBe(2) expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(3)
expect(vm.$el.querySelectorAll('.fjs-failed').length).toBe(1) expect(vm.$el.querySelectorAll('.fjs-submitted').length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-failed').length).toBe(1)
done()
})
}) })
}) })
it('cancel button works', () => { it('cancel button works', done => {
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}) Promise.all([
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'FAILURE'}) store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}),
Vue.nextTick(() => { store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'FAILURE'})
expect(Object.keys(store.getters.tasks).length).toBe(2) ]).then(() => {
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(2) Vue.nextTick(() => {
vm.$el.querySelectorAll('.fjs-cancel-btn').forEach(button => button.click()) expect(Object.keys(store.getters.tasks).length).toBe(2)
Vue.nextTick().then(() => { expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(2)
expect(Object.keys(store.getters.tasks).length).toBe(0) vm.$el.querySelectorAll('.fjs-cancel-btn').forEach(button => button.click())
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(0) Vue.nextTick(() => {
}).catch(() => fail()) expect(Object.keys(store.getters.tasks).length).toBe(0)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(0)
done()
})
})
}) })
}) })
}) })
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment