@@ -3,19 +3,22 @@ import chaiImmutable from 'chai-immutable';
3
3
import sinon from 'sinon' ;
4
4
import sinonChai from 'sinon-chai' ;
5
5
6
- chai . use ( chaiImmutable ) ;
7
- chai . use ( sinonChai ) ;
8
-
9
6
import { List } from 'immutable' ;
10
7
11
8
import EmojiService from '../../../src/services/symbols/EmojiService' ;
12
9
import TextSymbolService from '../../../src/services/symbols/TextSymbolService' ;
13
10
import SymbolService from '../../../src/services/symbols/SymbolService' ;
14
11
12
+ chai . use ( chaiImmutable ) ;
13
+ chai . use ( sinonChai ) ;
14
+
15
15
const expect = chai . expect ;
16
16
17
17
describe ( 'SymbolService Test' , ( ) => {
18
- const service = new SymbolService ( ) ;
18
+ let originalPlatform ;
19
+ let sandbox ;
20
+
21
+ let service = new SymbolService ( ) ;
19
22
20
23
describe ( '#getEmojiSupportedOperatingSystems' , ( ) => {
21
24
it ( 'should return operated systems that support emojis' , ( ) => {
@@ -24,16 +27,16 @@ describe('SymbolService Test', () => {
24
27
} ) ;
25
28
26
29
describe ( '#areEmojisSupported' , ( ) => {
27
- before ( function ( ) {
28
- this . originalPlatform = Object . getOwnPropertyDescriptor ( process , 'platform' ) ;
30
+ before ( ( ) => {
31
+ originalPlatform = Object . getOwnPropertyDescriptor ( process , 'platform' ) ;
29
32
30
33
Object . defineProperty ( process , 'platform' , {
31
- value : 'any-platform'
34
+ value : 'any-platform' ,
32
35
} ) ;
33
36
} ) ;
34
37
35
- after ( function ( ) {
36
- Object . defineProperty ( process , 'platform' , this . originalPlatform ) ;
38
+ after ( ( ) => {
39
+ Object . defineProperty ( process , 'platform' , originalPlatform ) ;
37
40
} ) ;
38
41
39
42
it ( 'should return if emojis are supported' , ( ) => {
@@ -42,7 +45,6 @@ describe('SymbolService Test', () => {
42
45
} ) ;
43
46
44
47
describe ( '#constructor' , ( ) => {
45
- let sandbox ;
46
48
beforeEach ( ( ) => {
47
49
sandbox = sinon . sandbox . create ( ) ;
48
50
} ) ;
@@ -54,16 +56,16 @@ describe('SymbolService Test', () => {
54
56
describe ( 'when emojis are supported' , ( ) => {
55
57
it ( 'client should be emoji service' , ( ) => {
56
58
sandbox . stub ( SymbolService , 'areEmojisSupported' ) . returns ( true ) ;
57
- const service = new SymbolService ( ) ;
58
- expect ( service . client instanceof EmojiService ) . to . be . true
59
+ service = new SymbolService ( ) ;
60
+ return expect ( service . client instanceof EmojiService ) . to . be . true ;
59
61
} ) ;
60
62
} ) ;
61
63
62
64
describe ( 'when emojis are not supported' , ( ) => {
63
65
it ( 'client should be text service' , ( ) => {
64
66
sandbox . stub ( SymbolService , 'areEmojisSupported' ) . returns ( false ) ;
65
- const service = new SymbolService ( ) ;
66
- expect ( service . client instanceof TextSymbolService ) . to . be . true ;
67
+ service = new SymbolService ( ) ;
68
+ return expect ( service . client instanceof TextSymbolService ) . to . be . true ;
67
69
} ) ;
68
70
} ) ;
69
71
} ) ;
@@ -72,71 +74,71 @@ describe('SymbolService Test', () => {
72
74
it ( 'should forward to client method' , ( ) => {
73
75
const clientSpy = sinon . spy ( service . client , 'getVehicleSymbol' ) ;
74
76
service . getVehicleSymbol ( ) ;
75
- expect ( clientSpy . calledOnce ) . to . be . true ;
77
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
76
78
} ) ;
77
79
} ) ;
78
80
79
81
describe ( '#getPriceSymbol' , ( ) => {
80
82
it ( 'should forward to client method' , ( ) => {
81
83
const clientSpy = sinon . spy ( service . client , 'getPriceSymbol' ) ;
82
84
service . getPriceSymbol ( ) ;
83
- expect ( clientSpy . calledOnce ) . to . be . true ;
85
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
84
86
} ) ;
85
87
} ) ;
86
88
87
89
describe ( '#getTripDistanceSymbol' , ( ) => {
88
90
it ( 'should forward to client method' , ( ) => {
89
91
const clientSpy = sinon . spy ( service . client , 'getTripDistanceSymbol' ) ;
90
92
service . getTripDistanceSymbol ( ) ;
91
- expect ( clientSpy . calledOnce ) . to . be . true ;
93
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
92
94
} ) ;
93
95
} ) ;
94
96
95
97
describe ( '#getDurationSymbol' , ( ) => {
96
98
it ( 'should forward to client method' , ( ) => {
97
99
const clientSpy = sinon . spy ( service . client , 'getDurationSymbol' ) ;
98
100
service . getDurationSymbol ( ) ;
99
- expect ( clientSpy . calledOnce ) . to . be . true ;
101
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
100
102
} ) ;
101
103
} ) ;
102
104
103
105
describe ( '#getSurgeSymbol' , ( ) => {
104
106
it ( 'should forward to client method' , ( ) => {
105
107
const clientSpy = sinon . spy ( service . client , 'getSurgeSymbol' ) ;
106
108
service . getSurgeSymbol ( ) ;
107
- expect ( clientSpy . calledOnce ) . to . be . true ;
109
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
108
110
} ) ;
109
111
} ) ;
110
112
111
113
describe ( '#getNotApplicableSymbol' , ( ) => {
112
114
it ( 'should forward to client method' , ( ) => {
113
115
const clientSpy = sinon . spy ( service . client , 'getNotApplicableSymbol' ) ;
114
116
service . getNotApplicableSymbol ( ) ;
115
- expect ( clientSpy . calledOnce ) . to . be . true ;
117
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
116
118
} ) ;
117
119
} ) ;
118
120
119
121
describe ( '#getDestinationSymbol' , ( ) => {
120
122
it ( 'should forward to client method' , ( ) => {
121
123
const clientSpy = sinon . spy ( service . client , 'getDestinationSymbol' ) ;
122
124
service . getDestinationSymbol ( ) ;
123
- expect ( clientSpy . calledOnce ) . to . be . true ;
125
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
124
126
} ) ;
125
127
} ) ;
126
128
127
129
describe ( '#getOriginSymbol' , ( ) => {
128
130
it ( 'should forward to client method' , ( ) => {
129
131
const clientSpy = sinon . spy ( service . client , 'getOriginSymbol' ) ;
130
132
service . getOriginSymbol ( ) ;
131
- expect ( clientSpy . calledOnce ) . to . be . true ;
133
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
132
134
} ) ;
133
135
} ) ;
134
136
135
137
describe ( '#getMaximumDistanceSymbol' , ( ) => {
136
138
it ( 'should forward to client method' , ( ) => {
137
139
const clientSpy = sinon . spy ( service . client , 'getMaximumDistanceSymbol' ) ;
138
140
service . getMaximumDistanceSymbol ( ) ;
139
- expect ( clientSpy . calledOnce ) . to . be . true ;
141
+ return expect ( clientSpy . calledOnce ) . to . be . true ;
140
142
} ) ;
141
143
} ) ;
142
144
} ) ;
0 commit comments