Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 63d2349

Browse files
committed
fix linting and tests
1 parent aec1009 commit 63d2349

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

src/services/symbols/EmojiService.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import emoji from 'node-emoji';
22

33

44
export default class EmojiService {
5-
constructor() {}
6-
75
getVehicleSymbol() {
86
return emoji.get('oncoming_automobile');
97
}

src/services/symbols/TextSymbolService.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
export default class TextSymbolService {
2-
constructor() {}
3-
42
getVehicleSymbol() {
53
return 'Vehicle';
64
}

test/services/symbols/SymbolServiceTest.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ import chaiImmutable from 'chai-immutable';
33
import sinon from 'sinon';
44
import sinonChai from 'sinon-chai';
55

6-
chai.use(chaiImmutable);
7-
chai.use(sinonChai);
8-
96
import { List } from 'immutable';
107

118
import EmojiService from '../../../src/services/symbols/EmojiService';
129
import TextSymbolService from '../../../src/services/symbols/TextSymbolService';
1310
import SymbolService from '../../../src/services/symbols/SymbolService';
1411

12+
chai.use(chaiImmutable);
13+
chai.use(sinonChai);
14+
1515
const expect = chai.expect;
1616

1717
describe('SymbolService Test', () => {
18-
const service = new SymbolService();
18+
let originalPlatform;
19+
let sandbox;
20+
21+
let service = new SymbolService();
1922

2023
describe('#getEmojiSupportedOperatingSystems', () => {
2124
it('should return operated systems that support emojis', () => {
@@ -24,16 +27,16 @@ describe('SymbolService Test', () => {
2427
});
2528

2629
describe('#areEmojisSupported', () => {
27-
before(function() {
28-
this.originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform');
30+
before(() => {
31+
originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform');
2932

3033
Object.defineProperty(process, 'platform', {
31-
value: 'any-platform'
34+
value: 'any-platform',
3235
});
3336
});
3437

35-
after(function() {
36-
Object.defineProperty(process, 'platform', this.originalPlatform);
38+
after(() => {
39+
Object.defineProperty(process, 'platform', originalPlatform);
3740
});
3841

3942
it('should return if emojis are supported', () => {
@@ -42,7 +45,6 @@ describe('SymbolService Test', () => {
4245
});
4346

4447
describe('#constructor', () => {
45-
let sandbox;
4648
beforeEach(() => {
4749
sandbox = sinon.sandbox.create();
4850
});
@@ -54,16 +56,16 @@ describe('SymbolService Test', () => {
5456
describe('when emojis are supported', () => {
5557
it('client should be emoji service', () => {
5658
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;
5961
});
6062
});
6163

6264
describe('when emojis are not supported', () => {
6365
it('client should be text service', () => {
6466
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;
6769
});
6870
});
6971
});
@@ -72,71 +74,71 @@ describe('SymbolService Test', () => {
7274
it('should forward to client method', () => {
7375
const clientSpy = sinon.spy(service.client, 'getVehicleSymbol');
7476
service.getVehicleSymbol();
75-
expect(clientSpy.calledOnce).to.be.true;
77+
return expect(clientSpy.calledOnce).to.be.true;
7678
});
7779
});
7880

7981
describe('#getPriceSymbol', () => {
8082
it('should forward to client method', () => {
8183
const clientSpy = sinon.spy(service.client, 'getPriceSymbol');
8284
service.getPriceSymbol();
83-
expect(clientSpy.calledOnce).to.be.true;
85+
return expect(clientSpy.calledOnce).to.be.true;
8486
});
8587
});
8688

8789
describe('#getTripDistanceSymbol', () => {
8890
it('should forward to client method', () => {
8991
const clientSpy = sinon.spy(service.client, 'getTripDistanceSymbol');
9092
service.getTripDistanceSymbol();
91-
expect(clientSpy.calledOnce).to.be.true;
93+
return expect(clientSpy.calledOnce).to.be.true;
9294
});
9395
});
9496

9597
describe('#getDurationSymbol', () => {
9698
it('should forward to client method', () => {
9799
const clientSpy = sinon.spy(service.client, 'getDurationSymbol');
98100
service.getDurationSymbol();
99-
expect(clientSpy.calledOnce).to.be.true;
101+
return expect(clientSpy.calledOnce).to.be.true;
100102
});
101103
});
102104

103105
describe('#getSurgeSymbol', () => {
104106
it('should forward to client method', () => {
105107
const clientSpy = sinon.spy(service.client, 'getSurgeSymbol');
106108
service.getSurgeSymbol();
107-
expect(clientSpy.calledOnce).to.be.true;
109+
return expect(clientSpy.calledOnce).to.be.true;
108110
});
109111
});
110112

111113
describe('#getNotApplicableSymbol', () => {
112114
it('should forward to client method', () => {
113115
const clientSpy = sinon.spy(service.client, 'getNotApplicableSymbol');
114116
service.getNotApplicableSymbol();
115-
expect(clientSpy.calledOnce).to.be.true;
117+
return expect(clientSpy.calledOnce).to.be.true;
116118
});
117119
});
118120

119121
describe('#getDestinationSymbol', () => {
120122
it('should forward to client method', () => {
121123
const clientSpy = sinon.spy(service.client, 'getDestinationSymbol');
122124
service.getDestinationSymbol();
123-
expect(clientSpy.calledOnce).to.be.true;
125+
return expect(clientSpy.calledOnce).to.be.true;
124126
});
125127
});
126128

127129
describe('#getOriginSymbol', () => {
128130
it('should forward to client method', () => {
129131
const clientSpy = sinon.spy(service.client, 'getOriginSymbol');
130132
service.getOriginSymbol();
131-
expect(clientSpy.calledOnce).to.be.true;
133+
return expect(clientSpy.calledOnce).to.be.true;
132134
});
133135
});
134136

135137
describe('#getMaximumDistanceSymbol', () => {
136138
it('should forward to client method', () => {
137139
const clientSpy = sinon.spy(service.client, 'getMaximumDistanceSymbol');
138140
service.getMaximumDistanceSymbol();
139-
expect(clientSpy.calledOnce).to.be.true;
141+
return expect(clientSpy.calledOnce).to.be.true;
140142
});
141143
});
142144
});

0 commit comments

Comments
 (0)