Skip to content

Commit 2497480

Browse files
committed
style(senna): lint tests
1 parent 3920b5b commit 2497480

File tree

9 files changed

+269
-269
lines changed

9 files changed

+269
-269
lines changed

maintenance/projects/senna/test/app/App.js

Lines changed: 125 additions & 125 deletions
Large diffs are not rendered by default.

maintenance/projects/senna/test/app/AppDataAttributeHandler.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ describe('AppDataAttributeHandler', () => {
2929
console.log.restore();
3030
});
3131

32-
it('should throw error when base element not specified', () => {
32+
it('throws error when base element not specified', () => {
3333
assert.throws(() => {
3434
new AppDataAttributeHandler().handle();
3535
}, Error);
3636
});
3737

38-
it('should throw error when base element not valid', () => {
38+
it('throws error when base element not valid', () => {
3939
assert.throws(() => {
4040
var appDataAttributeHandler = new AppDataAttributeHandler();
4141
appDataAttributeHandler.setBaseElement({});
4242
appDataAttributeHandler.handle();
4343
}, Error);
4444
});
4545

46-
it('should throw error when already handled', () => {
46+
it('throws error when already handled', () => {
4747
assert.throws(() => {
4848
var appDataAttributeHandler = new AppDataAttributeHandler();
4949
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -52,7 +52,7 @@ describe('AppDataAttributeHandler', () => {
5252
}, Error);
5353
});
5454

55-
it('should not throw error when base element specified', () => {
55+
it('does not throw error when base element specified', () => {
5656
assert.doesNotThrow(() => {
5757
var appDataAttributeHandler = new AppDataAttributeHandler();
5858
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -61,30 +61,30 @@ describe('AppDataAttributeHandler', () => {
6161
});
6262
});
6363

64-
it('should dispose internal app when disposed', () => {
64+
it('disposes internal app when disposed', () => {
6565
var appDataAttributeHandler = new AppDataAttributeHandler();
6666
appDataAttributeHandler.setBaseElement(globals.document.body);
6767
appDataAttributeHandler.handle();
6868
appDataAttributeHandler.dispose();
6969
assert.ok(appDataAttributeHandler.getApp().isDisposed());
7070
});
7171

72-
it('should dispose when not handled', () => {
72+
it('disposes when not handled', () => {
7373
assert.doesNotThrow(() => {
7474
var appDataAttributeHandler = new AppDataAttributeHandler();
7575
appDataAttributeHandler.dispose();
7676
});
7777
});
7878

79-
it('should get app', () => {
79+
it('gets app', () => {
8080
var appDataAttributeHandler = new AppDataAttributeHandler();
8181
appDataAttributeHandler.setBaseElement(globals.document.body);
8282
appDataAttributeHandler.handle();
8383
assert.ok(appDataAttributeHandler.getApp());
8484
appDataAttributeHandler.dispose();
8585
});
8686

87-
it('should get base element', () => {
87+
it('gets base element', () => {
8888
var appDataAttributeHandler = new AppDataAttributeHandler();
8989
appDataAttributeHandler.setBaseElement(globals.document.body);
9090
assert.strictEqual(
@@ -93,7 +93,7 @@ describe('AppDataAttributeHandler', () => {
9393
);
9494
});
9595

96-
it('should add app surfaces from document', () => {
96+
it('adds app surfaces from document', () => {
9797
enterDocumentSurfaceElement('surfaceId');
9898
var appDataAttributeHandler = new AppDataAttributeHandler();
9999
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -103,7 +103,7 @@ describe('AppDataAttributeHandler', () => {
103103
exitDocumentSurfaceElement('surfaceId');
104104
});
105105

106-
it('should adds random id to body without id when used as app surface', () => {
106+
it('adds random id to body without id when used as app surface', () => {
107107
globals.document.body.setAttribute('data-senna-surface', '');
108108
var appDataAttributeHandler = new AppDataAttributeHandler();
109109
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -113,7 +113,7 @@ describe('AppDataAttributeHandler', () => {
113113
globals.document.body.removeAttribute('data-senna-surface');
114114
});
115115

116-
it('should throw error when adding app surfaces from document missing id', () => {
116+
it('throws error when adding app surfaces from document missing id', () => {
117117
enterDocumentSurfaceElementMissingId('surfaceId');
118118
assert.throws(() => {
119119
var appDataAttributeHandler = new AppDataAttributeHandler();
@@ -123,15 +123,15 @@ describe('AppDataAttributeHandler', () => {
123123
exitDocumentSurfaceElementMissingId('surfaceId');
124124
});
125125

126-
it('should add default route if not found in document', () => {
126+
it('adds default route if not found in document', () => {
127127
var appDataAttributeHandler = new AppDataAttributeHandler();
128128
appDataAttributeHandler.setBaseElement(globals.document.body);
129129
appDataAttributeHandler.handle();
130130
assert.ok(appDataAttributeHandler.getApp().hasRoutes());
131131
appDataAttributeHandler.dispose();
132132
});
133133

134-
it('should add routes from document', () => {
134+
it('adds routes from document', () => {
135135
enterDocumentRouteElement('/path1');
136136
enterDocumentRouteElement('/path2');
137137
var appDataAttributeHandler = new AppDataAttributeHandler();
@@ -143,7 +143,7 @@ describe('AppDataAttributeHandler', () => {
143143
exitDocumentRouteElement('/path2');
144144
});
145145

146-
it('should add routes from document with regex paths', () => {
146+
it('adds routes from document with regex paths', () => {
147147
enterDocumentRouteElement('regex:[a-z]');
148148
var appDataAttributeHandler = new AppDataAttributeHandler();
149149
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -156,7 +156,7 @@ describe('AppDataAttributeHandler', () => {
156156
exitDocumentRouteElement('regex:[a-z]');
157157
});
158158

159-
it('should throw error when adding routes from document with missing screen type', () => {
159+
it('throws error when adding routes from document with missing screen type', () => {
160160
enterDocumentRouteElementMissingScreenType('/path');
161161
assert.throws(() => {
162162
var appDataAttributeHandler = new AppDataAttributeHandler();
@@ -166,7 +166,7 @@ describe('AppDataAttributeHandler', () => {
166166
exitDocumentRouteElement('/path');
167167
});
168168

169-
it('should throw error when adding routes from document with missing path', () => {
169+
it('throws error when adding routes from document with missing path', () => {
170170
enterDocumentRouteElementMissingPath();
171171
assert.throws(() => {
172172
var appDataAttributeHandler = new AppDataAttributeHandler();
@@ -176,7 +176,7 @@ describe('AppDataAttributeHandler', () => {
176176
exitDocumentRouteElementMissingPath();
177177
});
178178

179-
it('should set base path from data attribute', () => {
179+
it('sets base path from data attribute', () => {
180180
globals.document.body.setAttribute('data-senna-base-path', '/base');
181181
var appDataAttributeHandler = new AppDataAttributeHandler();
182182
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -189,7 +189,7 @@ describe('AppDataAttributeHandler', () => {
189189
globals.document.body.removeAttribute('data-senna-base-path');
190190
});
191191

192-
it('should set link selector from data attribute', () => {
192+
it('sets link selector from data attribute', () => {
193193
globals.document.body.setAttribute('data-senna-link-selector', 'a');
194194
var appDataAttributeHandler = new AppDataAttributeHandler();
195195
appDataAttributeHandler.setBaseElement(globals.document.body);
@@ -202,7 +202,7 @@ describe('AppDataAttributeHandler', () => {
202202
globals.document.body.removeAttribute('data-senna-link-selector');
203203
});
204204

205-
it('should set loading css class from data attribute', () => {
205+
it('sets loading css class from data attribute', () => {
206206
globals.document.body.setAttribute(
207207
'data-senna-loading-css-class',
208208
'loading'
@@ -218,7 +218,7 @@ describe('AppDataAttributeHandler', () => {
218218
globals.document.body.removeAttribute('data-senna-loading-css-class');
219219
});
220220

221-
it('should set update scroll position to false from data attribute', () => {
221+
it('sets update scroll position to false from data attribute', () => {
222222
globals.document.body.setAttribute(
223223
'data-senna-update-scroll-position',
224224
'false'
@@ -236,7 +236,7 @@ describe('AppDataAttributeHandler', () => {
236236
);
237237
});
238238

239-
it('should set update scroll position to true from data attribute', () => {
239+
it('sets update scroll position to true from data attribute', () => {
240240
globals.document.body.setAttribute(
241241
'data-senna-update-scroll-position',
242242
'true'
@@ -254,7 +254,7 @@ describe('AppDataAttributeHandler', () => {
254254
);
255255
});
256256

257-
it('should dispatch app from data attribute', () => {
257+
it('dispatches app from data attribute', () => {
258258
globals.document.body.setAttribute('data-senna-dispatch', '');
259259
var appDataAttributeHandler = new AppDataAttributeHandler();
260260
appDataAttributeHandler.setBaseElement(globals.document.body);

maintenance/projects/senna/test/cacheable/Cacheable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
import Cacheable from '../../src/cacheable/Cacheable';
99

1010
describe('Cacheable', () => {
11-
it('should not be cacheable by default', () => {
11+
it('is not be cacheable by default', () => {
1212
assert.ok(!new Cacheable().isCacheable());
1313
});
1414

15-
it('should be cacheable', () => {
15+
it('is cacheable', () => {
1616
var cacheable = new Cacheable();
1717
cacheable.setCacheable(true);
1818
assert.ok(cacheable.isCacheable());
1919
});
2020

21-
it('should clear cache when toggle cacheable state', () => {
21+
it('clears cache when toggle cacheable state', () => {
2222
var cacheable = new Cacheable();
2323
cacheable.setCacheable(true);
2424
cacheable.addCache('data');
@@ -27,7 +27,7 @@ describe('Cacheable', () => {
2727
assert.strictEqual(null, cacheable.getCache());
2828
});
2929

30-
it('should clear cache on dispose', () => {
30+
it('clears cache on dispose', () => {
3131
var cacheable = new Cacheable();
3232
cacheable.setCacheable(true);
3333
cacheable.addCache('data');

maintenance/projects/senna/test/route/Route.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,88 +11,88 @@ import Route from '../../src/route/Route';
1111

1212
describe('Route', () => {
1313
describe('Constructor', () => {
14-
it('should throws error when path and handler not specified', () => {
14+
it('throws error when path and handler not specified', () => {
1515
assert.throws(() => {
1616
new Route();
1717
}, Error);
1818
});
1919

20-
it('should throws error when path is null', () => {
20+
it('throws error when path is null', () => {
2121
assert.throws(() => {
2222
new Route(null, core.nullFunction);
2323
}, Error);
2424
});
2525

26-
it('should throws error when path is undefined', () => {
26+
it('throws error when path is undefined', () => {
2727
assert.throws(() => {
2828
new Route(undefined, core.nullFunction);
2929
}, Error);
3030
});
3131

32-
it('should throws error when handler not specified', () => {
32+
it('throws error when handler not specified', () => {
3333
assert.throws(() => {
3434
new Route('/path');
3535
}, Error);
3636
});
3737

38-
it('should throws error when handler not a function', () => {
38+
it('throws error when handler not a function', () => {
3939
assert.throws(() => {
4040
new Route('/path', {});
4141
}, Error);
4242
});
4343

44-
it('should not throws error when handler is a function', () => {
44+
it('does not throws error when handler is a function', () => {
4545
assert.doesNotThrow(() => {
4646
new Route('/path', core.nullFunction);
4747
});
4848
});
4949

50-
it('should set path and handler from constructor', () => {
50+
it('sets path and handler from constructor', () => {
5151
var route = new Route('/path', core.nullFunction);
5252
assert.strictEqual('/path', route.getPath());
5353
assert.strictEqual(core.nullFunction, route.getHandler());
5454
});
5555
});
5656

5757
describe('Matching', () => {
58-
it('should match route by string path', () => {
58+
it('matches route by string path', () => {
5959
var route = new Route('/path', core.nullFunction);
6060
assert.ok(route.matchesPath('/path'));
6161
});
6262

63-
it('should match route by string path with params', () => {
63+
it('matches route by string path with params', () => {
6464
var route = new Route('/path/:foo(\\d+)', core.nullFunction);
6565
assert.ok(route.matchesPath('/path/10'));
6666
assert.ok(route.matchesPath('/path/10/'));
6767
assert.ok(!route.matchesPath('/path/abc'));
6868
assert.ok(!route.matchesPath('/path'));
6969
});
7070

71-
it('should match route by regex path', () => {
71+
it('matches route by regex path', () => {
7272
var route = new Route(/\/path/, core.nullFunction);
7373
assert.ok(route.matchesPath('/path'));
7474
});
7575

76-
it('should match route by function path', () => {
76+
it('matches route by function path', () => {
7777
var route = new Route((path) => {
7878
return path === '/path';
7979
}, core.nullFunction);
8080
assert.ok(route.matchesPath('/path'));
8181
});
8282

83-
it('should not match any route', () => {
83+
it('does not match any route', () => {
8484
var route = new Route('/path', core.nullFunction);
8585
assert.ok(!route.matchesPath('/invalid'));
8686
});
8787

88-
it('should not match any route for invalid path', () => {
88+
it('does not match any route for invalid path', () => {
8989
var route = new Route({}, core.nullFunction);
9090
assert.ok(!route.matchesPath('/invalid'));
9191
});
9292
});
9393

9494
describe('Extracting params', () => {
95-
it('should extract params from path matching route', () => {
95+
it('extracts params from path matching route', () => {
9696
var route = new Route(
9797
'/path/:foo(\\d+)/:bar(\\w+)',
9898
core.nullFunction
@@ -105,7 +105,7 @@ describe('Route', () => {
105105
assert.deepEqual(expected, params);
106106
});
107107

108-
it('should return null if try to extract params from non matching route', () => {
108+
it('returns null if try to extract params from non matching route', () => {
109109
var route = new Route(
110110
'/path/:foo(\\d+)/:bar(\\w+)',
111111
core.nullFunction
@@ -114,7 +114,7 @@ describe('Route', () => {
114114
assert.strictEqual(null, params);
115115
});
116116

117-
it('should return empty object if trying to extract params from path given as function', () => {
117+
it('returns empty object if trying to extract params from path given as function', () => {
118118
var route = new Route(core.nullFunction, core.nullFunction);
119119
var params = route.extractParams('/path/123/abc');
120120
assert.deepEqual({}, params);

0 commit comments

Comments
 (0)