@@ -9,12 +9,12 @@ import flushPromises from 'flush-promises'
9
9
const localVue = createLocalVue ( )
10
10
localVue . use ( BootstrapVue )
11
11
12
- function createWrapper ( $http )
12
+ function createWrapper ( $http , authenticated )
13
13
{
14
14
const $store = {
15
15
getters : {
16
16
user : {
17
- authenticated : false
17
+ authenticated : authenticated
18
18
}
19
19
}
20
20
}
@@ -51,7 +51,7 @@ describe('Event.vue', () => {
51
51
expect ( wrapper . vm . event . id ) . to . eql ( EVENT_DATA . id )
52
52
} )
53
53
54
- } ] ,
54
+ } , true ] ,
55
55
56
56
[ 'Response Success if not user authenticated' , ( ) => Promise . resolve ( resp ) , wrapper => {
57
57
flushPromises ( ) . then ( ( ) => {
@@ -68,15 +68,36 @@ describe('Event.vue', () => {
68
68
flushPromises ( ) . then ( ( ) => {
69
69
expect ( wrapper . vm . errorResponse . status ) . to . eql ( 403 )
70
70
} )
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
+
71
92
} ]
72
93
73
94
] ) . forEach ( conf => {
74
95
75
- const [ label , httpResp , callBack ] = conf
96
+ const [ label , httpResp , callBack , authenticated ] = conf
76
97
77
98
const wrapper = createWrapper ( {
78
99
get : httpResp
79
- } )
100
+ } , ! ! authenticated )
80
101
81
102
it ( label , async ( ) => {
82
103
callBack ( wrapper )
0 commit comments