Skip to content

Commit 786f7a7

Browse files
committed
Adds linting to tests
1 parent ca9000e commit 786f7a7

40 files changed

+999
-985
lines changed

src/__tests__/.eslintrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"env": {
3+
"jest": true
4+
},
5+
"globals": {
6+
7+
},
8+
"rules": {
9+
"no-console": [0],
10+
"no-var": "error"
11+
}
12+
}

src/__tests__/Analytics-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
jest.dontMock('../Analytics');
1111
jest.dontMock('../CoreManager');
1212

13-
var Analytics = require('../Analytics');
14-
var CoreManager = require('../CoreManager');
13+
const Analytics = require('../Analytics');
14+
const CoreManager = require('../CoreManager');
1515

16-
var defaultController = CoreManager.getAnalyticsController();
16+
const defaultController = CoreManager.getAnalyticsController();
1717

1818
describe('Analytics', () => {
1919
beforeEach(() => {
20-
var track = jest.fn();
20+
const track = jest.fn();
2121
track.mockReturnValue(Promise.resolve());
2222
CoreManager.setAnalyticsController({ track: track });
2323
});
@@ -62,12 +62,12 @@ describe('Analytics', () => {
6262
describe('AnalyticsController', () => {
6363
beforeEach(() => {
6464
CoreManager.setAnalyticsController(defaultController);
65-
var request = jest.fn();
65+
const request = jest.fn();
6666
request.mockReturnValue(Promise.resolve({
6767
success: true,
6868
result: {}
6969
}));
70-
var ajax = jest.fn();
70+
const ajax = jest.fn();
7171
CoreManager.setRESTController({ request: request, ajax: ajax });
7272
});
7373

src/__tests__/Cloud-test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ jest.dontMock('../CoreManager');
1212
jest.dontMock('../decode');
1313
jest.dontMock('../encode');
1414

15-
var Cloud = require('../Cloud');
16-
var CoreManager = require('../CoreManager');
15+
const Cloud = require('../Cloud');
16+
const CoreManager = require('../CoreManager');
1717

18-
var defaultController = CoreManager.getCloudController();
18+
const defaultController = CoreManager.getCloudController();
1919

2020
describe('Cloud', () => {
2121
beforeEach(() => {
22-
var run = jest.fn();
23-
var getJobsData = jest.fn();
24-
var startJob = jest.fn();
22+
const run = jest.fn();
23+
const getJobsData = jest.fn();
24+
const startJob = jest.fn();
2525
run.mockReturnValue(Promise.resolve({
2626
result: {}
2727
}));
@@ -115,12 +115,12 @@ describe('Cloud', () => {
115115
describe('CloudController', () => {
116116
beforeEach(() => {
117117
CoreManager.setCloudController(defaultController);
118-
var request = jest.fn();
118+
const request = jest.fn();
119119
request.mockReturnValue(Promise.resolve({
120120
success: true,
121121
result: {}
122122
}));
123-
var ajax = jest.fn();
123+
const ajax = jest.fn();
124124
CoreManager.setRESTController({ request: request, ajax: ajax });
125125
});
126126

@@ -149,12 +149,12 @@ describe('CloudController', () => {
149149
}, { sessionToken: 'asdf1234' }]);
150150
});
151151

152-
it('run invalid response', () => {
153-
var request = jest.fn();
152+
it('run invalid response', (done) => {
153+
const request = jest.fn();
154154
request.mockReturnValue(Promise.resolve({
155155
success: false
156156
}));
157-
var ajax = jest.fn();
157+
const ajax = jest.fn();
158158
CoreManager.setRESTController({ request: request, ajax: ajax });
159159

160160
Cloud.run('myfunction').then(null).catch(() => {

src/__tests__/CoreManager-test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
jest.dontMock('../CoreManager');
1111

12-
var CoreManager = require('../CoreManager');
12+
const CoreManager = require('../CoreManager');
1313

1414
describe('CoreManager', () => {
1515
it('is initialized with default values', () => {
@@ -43,7 +43,7 @@ describe('CoreManager', () => {
4343
});
4444

4545
it('can set and get AnalyticsController', () => {
46-
var controller = {
46+
const controller = {
4747
track: function() {}
4848
};
4949

@@ -65,7 +65,7 @@ describe('CoreManager', () => {
6565
});
6666

6767
it('can set and get CloudController', () => {
68-
var controller = {
68+
const controller = {
6969
run: function() {},
7070
getJobsData: function() {},
7171
startJob: function() {},
@@ -92,7 +92,7 @@ describe('CoreManager', () => {
9292
});
9393

9494
it('can set and get ConfigController', () => {
95-
var controller = {
95+
const controller = {
9696
current: function() {},
9797
get: function() {}
9898
};
@@ -117,7 +117,7 @@ describe('CoreManager', () => {
117117
});
118118

119119
it('can set and get FileController', () => {
120-
var controller = {
120+
const controller = {
121121
saveFile: function() {},
122122
saveBase64: function() {}
123123
};
@@ -137,7 +137,7 @@ describe('CoreManager', () => {
137137
});
138138

139139
it('can set and get InstallationController', () => {
140-
var controller = {
140+
const controller = {
141141
currentInstallationId: function() {}
142142
};
143143

@@ -156,7 +156,7 @@ describe('CoreManager', () => {
156156
});
157157

158158
it('can set and get PushController', () => {
159-
var controller = {
159+
const controller = {
160160
send: function() {}
161161
};
162162

@@ -186,7 +186,7 @@ describe('CoreManager', () => {
186186
});
187187

188188
it('can set and get ObjectController', () => {
189-
var controller = {
189+
const controller = {
190190
save: function() {},
191191
fetch: function() {},
192192
destroy: function() {}
@@ -197,7 +197,7 @@ describe('CoreManager', () => {
197197
});
198198

199199
it('can set and get ObjectStateController', () => {
200-
var controller = {
200+
const controller = {
201201
getState: function() {},
202202
initializeState: function() {},
203203
removeState: function() {},
@@ -232,7 +232,7 @@ describe('CoreManager', () => {
232232
});
233233

234234
it('can set and get QueryController', () => {
235-
var controller = {
235+
const controller = {
236236
find: function() {},
237237
aggregate: function() {}
238238
};
@@ -257,7 +257,7 @@ describe('CoreManager', () => {
257257
});
258258

259259
it('can set and get RESTController', () => {
260-
var controller = {
260+
const controller = {
261261
request: function() {},
262262
ajax: function() {}
263263
};
@@ -313,7 +313,7 @@ describe('CoreManager', () => {
313313
});
314314

315315
it('can set and get StorageController', () => {
316-
var controller = {
316+
const controller = {
317317
async: 0,
318318
getItem: function() {},
319319
setItem: function() {},
@@ -340,7 +340,7 @@ describe('CoreManager', () => {
340340
});
341341

342342
it('can set and get SchemaController', () => {
343-
var controller = {
343+
const controller = {
344344
send: function() {},
345345
get: function() {},
346346
create: function() {},

0 commit comments

Comments
 (0)