Skip to content

Commit 698392c

Browse files
author
Arman
committed
1 parent 00e78c6 commit 698392c

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

test/unit/specs/Event.spec.js

+26-5
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import flushPromises from 'flush-promises'
99
const localVue = createLocalVue()
1010
localVue.use(BootstrapVue)
1111

12-
function createWrapper($http)
12+
function createWrapper($http, authenticated)
1313
{
1414
const $store = {
1515
getters: {
1616
user: {
17-
authenticated: false
17+
authenticated: authenticated
1818
}
1919
}
2020
}
@@ -51,7 +51,7 @@ describe('Event.vue', () => {
5151
expect(wrapper.vm.event.id).to.eql(EVENT_DATA.id)
5252
})
5353

54-
}],
54+
}, true],
5555

5656
['Response Success if not user authenticated', () => Promise.resolve(resp), wrapper => {
5757
flushPromises().then(() => {
@@ -68,15 +68,36 @@ describe('Event.vue', () => {
6868
flushPromises().then(() => {
6969
expect(wrapper.vm.errorResponse.status).to.eql(403)
7070
})
71+
}],
72+
73+
['Magnitude Types', () => Promise.resolve(resp), wrapper => {
74+
75+
const magnitudeTypes = {
76+
'L': [['M', 'L']],
77+
'b': [['m', 'b']],
78+
'B': [['m', 'B']],
79+
's': [['M', 's']],
80+
'S': [['M', 'S']],
81+
'W': [['M', 'W']],
82+
'G': [['M', 'b'], ['L', 'g']],
83+
'C': [['M', 'c']],
84+
'mww': [['M', 'mww']],
85+
'': [['M', '']]
86+
}
87+
88+
for (let [k, v] of Object.entries(magnitudeTypes)) {
89+
expect(wrapper.vm.magnitudeType(k)).to.eql(v)
90+
}
91+
7192
}]
7293

7394
]).forEach(conf => {
7495

75-
const [label, httpResp, callBack] = conf
96+
const [label, httpResp, callBack, authenticated] = conf
7697

7798
const wrapper = createWrapper({
7899
get: httpResp
79-
})
100+
}, !!authenticated)
80101

81102
it(label, async () => {
82103
callBack(wrapper)

0 commit comments

Comments
 (0)