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', () => {
vm = new Component().$mount()
})
it('shows all SUBMITTED or FAILED tasks in store', () => {
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'})
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'SUCCESS'})
store.dispatch('setTask', {taskID: 3, taskName: 'C', taskState: 'SUBMITTED'})
store.dispatch('setTask', {taskID: 4, taskName: 'D', taskState: 'FAILURE'})
store.dispatch('setTask', {taskID: 5, taskName: 'E', taskState: 'YAY'})
store.dispatch('setTask', {taskID: 6, taskName: 'F', taskState: 'PENDING'})
Vue.nextTick(() => {
expect(Object.keys(store.getters.tasks).length).toBe(6)
expect(Object.keys(vm.incompleteTasks).length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(3)
expect(vm.$el.querySelectorAll('.fjs-submitted').length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-failed').length).toBe(1)
it('shows all SUBMITTED or FAILED tasks in store', done => {
Promise.all([
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}),
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'SUCCESS'}),
store.dispatch('setTask', {taskID: 3, taskName: 'C', taskState: 'SUBMITTED'}),
store.dispatch('setTask', {taskID: 4, taskName: 'D', taskState: 'FAILURE'}),
store.dispatch('setTask', {taskID: 5, taskName: 'E', taskState: 'YAY'}),
store.dispatch('setTask', {taskID: 6, taskName: 'F', taskState: 'PENDING'})
]).then(() => {
Vue.nextTick(() => {
expect(Object.keys(store.getters.tasks).length).toBe(6)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(3)
expect(vm.$el.querySelectorAll('.fjs-submitted').length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-failed').length).toBe(1)
done()
})
})
})
it('cancel button works', () => {
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'})
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'FAILURE'})
Vue.nextTick(() => {
expect(Object.keys(store.getters.tasks).length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(2)
vm.$el.querySelectorAll('.fjs-cancel-btn').forEach(button => button.click())
Vue.nextTick().then(() => {
expect(Object.keys(store.getters.tasks).length).toBe(0)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(0)
}).catch(() => fail())
it('cancel button works', done => {
Promise.all([
store.dispatch('setTask', {taskID: 1, taskName: 'A', taskState: 'SUBMITTED'}),
store.dispatch('setTask', {taskID: 2, taskName: 'B', taskState: 'FAILURE'})
]).then(() => {
Vue.nextTick(() => {
expect(Object.keys(store.getters.tasks).length).toBe(2)
expect(vm.$el.querySelectorAll('.fjs-state-container').length).toBe(2)
vm.$el.querySelectorAll('.fjs-cancel-btn').forEach(button => button.click())
Vue.nextTick(() => {
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