Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractal.js
Commits
1585fffa
Commit
1585fffa
authored
Apr 26, 2017
by
Sascha Herzinger
Browse files
Fixing tests
parent
1cb5243d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/components/mixins/request-handling.js
View file @
1585fffa
...
...
@@ -18,7 +18,7 @@ export default {
if
(
jobInfo
.
state
===
'
SUCCESS
'
)
{
return
jobInfo
.
result
}
else
if
(
jobInfo
.
state
===
'
FAILURE
'
)
{
throw
jobInfo
.
result
throw
new
Error
(
jobInfo
.
result
)
}
else
if
(
jobInfo
.
state
===
'
PENDING
'
)
{
}
else
{
throw
new
Error
(
`Analysis Job has unknown state:
${
jobInfo
.
state
}
`
)
...
...
test/data-box-test.js
View file @
1585fffa
...
...
@@ -13,35 +13,35 @@ describe('DataBox', () => {
it
(
'
renders 3 checkboxes for 3 elements in data
'
,
()
=>
{
store
.
state
.
data
=
[
{
data
T
ype
:
'
numeric
'
,
description
:
''
},
{
data
T
ype
:
'
numeric
'
,
description
:
''
},
{
data
T
ype
:
'
numeric
'
,
description
:
''
}
{
data
_t
ype
:
'
numeric
'
,
description
:
''
},
{
data
_t
ype
:
'
numeric
'
,
description
:
''
},
{
data
_t
ype
:
'
numeric
'
,
description
:
''
}
]
const
Component
=
Vue
.
extend
(
DataBox
)
const
propsData
=
{
dataType
:
'
numeric
'
}
const
propsData
=
{
dataType
:
'
numeric
'
,
header
:
''
}
const
vm
=
new
Component
({
propsData
}).
$mount
()
expect
(
vm
.
$el
.
querySelectorAll
(
'
.data-item
'
).
length
).
toBe
(
3
)
})
it
(
'
only renders checkboxes for data with correct type
'
,
()
=>
{
store
.
state
.
data
=
[
{
data
T
ype
:
'
numeric
'
,
description
:
''
},
{
data
T
ype
:
'
categoric
'
,
description
:
''
},
{
data
_t
ype
:
'
numeric
'
,
description
:
''
},
{
data
_t
ype
:
'
categoric
'
,
description
:
''
},
]
const
Component
=
Vue
.
extend
(
DataBox
)
const
propsData
=
{
dataType
:
'
numeric
'
}
const
propsData
=
{
dataType
:
'
numeric
'
,
header
:
''
}
const
vm
=
new
Component
({
propsData
}).
$mount
()
expect
(
vm
.
$el
.
querySelectorAll
(
'
.data-item
'
).
length
).
toBe
(
1
)
})
it
(
'
checkboxes are linked to data
'
,
()
=>
{
store
.
state
.
data
=
[
{
data
T
ype
:
'
numeric
'
,
description
:
'
A
'
},
{
data
T
ype
:
'
numeric
'
,
description
:
'
B
'
}
,
{
data
_t
ype
:
'
numeric
'
,
description
:
''
,
data_id
:
'
A
'
},
{
data
_t
ype
:
'
numeric
'
,
description
:
'
'
,
data_id
:
'
'
}
]
const
Component
=
Vue
.
extend
(
DataBox
)
const
propsData
=
{
dataType
:
'
numeric
'
}
const
data
=
{
ch
ec
k
edI
tem
s
:
[
'
A
'
]}
const
propsData
=
{
dataType
:
'
numeric
'
,
header
:
''
}
const
data
=
{
sel
ec
t
edI
D
s
:
[
'
A
'
]}
const
vm
=
new
Component
({
propsData
,
data
}).
$mount
()
expect
(
vm
.
$el
.
querySelectorAll
(
'
.data-item
'
).
length
).
toBe
(
2
)
expect
(
vm
.
$el
.
querySelector
(
'
#data-check-0
'
).
checked
).
toBeTruthy
()
...
...
test/request-handling-test.js
View file @
1585fffa
...
...
@@ -20,9 +20,9 @@ describe('runAnalysis method', () => {
it
(
'
fails if unknown job state
'
,
done
=>
{
spyOn
(
store
.
getters
.
requestManager
,
'
createAnalysis
'
)
.
and
.
returnValue
(
Promise
.
resolve
(
123
))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
job_id
:
123
}}
))
spyOn
(
store
.
getters
.
requestManager
,
'
getAnalysisStatus
'
)
.
and
.
returnValue
(
Promise
.
resolve
({
state
:
'
FOO
'
,
result
:
''
}))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
state
:
'
FOO
'
,
result
:
''
}
}
))
runAnalysis
({
name
:
''
,
args
:
{}})
.
then
(
done
.
fail
)
.
catch
(
done
)
...
...
@@ -30,9 +30,9 @@ describe('runAnalysis method', () => {
it
(
'
resolves if job state is successful
'
,
done
=>
{
spyOn
(
store
.
getters
.
requestManager
,
'
createAnalysis
'
)
.
and
.
returnValue
(
Promise
.
resolve
(
123
))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
job_id
:
123
}}
))
spyOn
(
store
.
getters
.
requestManager
,
'
getAnalysisStatus
'
)
.
and
.
returnValue
(
Promise
.
resolve
({
state
:
'
SUCCESS
'
,
result
:
123
}))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
state
:
'
SUCCESS
'
,
result
:
123
}
}
))
runAnalysis
({
name
:
''
,
args
:
{}})
.
then
(
response
=>
{
expect
(
response
).
toBe
(
123
)
...
...
@@ -43,9 +43,9 @@ describe('runAnalysis method', () => {
it
(
'
rejects if job state is unsuccessful
'
,
done
=>
{
spyOn
(
store
.
getters
.
requestManager
,
'
createAnalysis
'
)
.
and
.
returnValue
(
Promise
.
resolve
(
123
))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
job_id
:
123
}}
))
spyOn
(
store
.
getters
.
requestManager
,
'
getAnalysisStatus
'
)
.
and
.
returnValue
(
Promise
.
resolve
({
state
:
'
FAILURE
'
,
result
:
''
}))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
state
:
'
FAILURE
'
,
result
:
''
}
}
))
runAnalysis
({
name
:
''
,
args
:
{}})
.
then
(
done
.
fail
)
.
catch
(
done
)
...
...
@@ -53,13 +53,13 @@ describe('runAnalysis method', () => {
it
(
'
does wait for job state to switch from PENDING to final state
'
,
done
=>
{
spyOn
(
store
.
getters
.
requestManager
,
'
createAnalysis
'
)
.
and
.
returnValue
(
Promise
.
resolve
(
123
))
.
and
.
returnValue
(
Promise
.
resolve
(
{
data
:
{
job_id
:
123
}}
))
spyOn
(
store
.
getters
.
requestManager
,
'
getAnalysisStatus
'
)
.
and
.
returnValues
(
Promise
.
resolve
({
state
:
'
PENDING
'
,
result
:
''
}),
Promise
.
resolve
({
state
:
'
PENDING
'
,
result
:
''
}),
Promise
.
resolve
({
state
:
'
PENDING
'
,
result
:
''
}),
Promise
.
resolve
({
state
:
'
SUCCESS
'
,
result
:
123
})
Promise
.
resolve
(
{
data
:
{
state
:
'
PENDING
'
,
result
:
''
}
}
),
Promise
.
resolve
(
{
data
:
{
state
:
'
PENDING
'
,
result
:
''
}
}
),
Promise
.
resolve
(
{
data
:
{
state
:
'
PENDING
'
,
result
:
''
}
}
),
Promise
.
resolve
(
{
data
:
{
state
:
'
SUCCESS
'
,
result
:
123
}
}
)
)
runAnalysis
({
name
:
''
,
args
:
{}})
.
then
(
response
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment