Skip to content

Commit b95b0ca

Browse files
chore(tslint): run tslint --fix on the typescript tests
1 parent 12bc7d8 commit b95b0ca

25 files changed

+1475
-1475
lines changed

test/_matchers.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference path="./_matchers.d.ts" />
22

3-
import {equals} from "../src/common/common";
3+
import { equals } from '../src/common/common';
44
declare var testablePromise;
55

66
beforeEach(function() {
@@ -9,37 +9,37 @@ beforeEach(function() {
99
return {
1010
compare: function(actual, expected) {
1111
return { pass: equals(actual, expected) };
12-
}
13-
}
12+
},
13+
};
1414
},
1515

1616
toEqualValues: function() {
1717
return {
1818
compare: function(actual, expected) {
19-
let pass = Object.keys(expected)
19+
const pass = Object.keys(expected)
2020
.reduce((acc, key) => acc && equals(actual[key], expected[key]), true);
2121
return { pass };
22-
}
23-
}
22+
},
23+
};
2424
},
2525

2626
toBeResolved: () => ({
2727
compare: actual => ({
28-
pass: !!testablePromise(actual).$$resolved
29-
})
28+
pass: !!testablePromise(actual).$$resolved,
29+
}),
3030
}),
3131

3232
toHaveClass: function() {
3333
return {
3434
compare: function(actual, clazz) {
35-
var classes = Array.prototype.slice.call(actual[0].classList);
36-
var pass = classes.indexOf(clazz) !== -1;
37-
var message = pass ? undefined : "Expected '" + (actual) + "' to have class '" + clazz + "'.";
35+
const classes = Array.prototype.slice.call(actual[0].classList);
36+
const pass = classes.indexOf(clazz) !== -1;
37+
const message = pass ? undefined : "Expected '" + (actual) + "' to have class '" + clazz + "'.";
3838

39-
return { pass: pass, message: message};
40-
}
39+
return { pass: pass, message: message };
40+
},
4141
};
42-
}
42+
},
4343

4444
});
4545
});

test/_testUtils.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { pick, forEach, omit } from "../src/index";
2-
import { map } from "../src/common/common";
1+
import { pick, forEach, omit } from '../src/index';
2+
import { map } from '../src/common/common';
33

4-
let stateProps = ["resolve", "resolvePolicy", "data", "template", "templateUrl", "url", "name", "params"];
4+
const stateProps = ['resolve', 'resolvePolicy', 'data', 'template', 'templateUrl', 'url', 'name', 'params'];
55

66
const initialUrl = document.location.href;
77
export const resetBrowserUrl = () =>
@@ -14,8 +14,8 @@ export const _delay = (ms) => () => delay(ms);
1414
export function tree2Array(tree, inheritName) {
1515

1616
function processState(parent, state, name) {
17-
let substates: any = omit(state, stateProps);
18-
let thisState: any = pick(state, stateProps);
17+
const substates: any = omit(state, stateProps);
18+
const thisState: any = pick(state, stateProps);
1919
thisState.name = name;
2020
if (!inheritName) thisState.parent = parent;
2121

@@ -31,7 +31,7 @@ export function tree2Array(tree, inheritName) {
3131
return states;
3232
}
3333

34-
return processChildren("", tree);
34+
return processChildren('', tree);
3535
}
3636

3737
export function PromiseResult(promise?) {
@@ -43,11 +43,11 @@ export function PromiseResult(promise?) {
4343
throw new Error("Already have with'd a promise.");
4444
}
4545

46-
let onfulfilled = (data) =>
46+
const onfulfilled = (data) =>
4747
resolve = data || true;
48-
let onrejected = (err) =>
48+
const onrejected = (err) =>
4949
reject = err || true;
50-
let done = () =>
50+
const done = () =>
5151
complete = true;
5252

5353
_promise = promise;
@@ -68,7 +68,7 @@ export function PromiseResult(promise?) {
6868
}
6969

7070
export const awaitTransition = (router) => new Promise(resolve => {
71-
let dereg = router.transitionService.onSuccess({}, (trans) => {
71+
const dereg = router.transitionService.onSuccess({}, (trans) => {
7272
dereg();
7373
resolve(trans);
7474
});

test/_testingPlugin.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { UIRouter } from "../src/router";
2-
import { UIRouterPluginBase } from "../src/interface";
3-
import * as vanilla from "../src/vanilla";
4-
import { UrlService } from "../src/url/urlService";
1+
import { UIRouter } from '../src/router';
2+
import { UIRouterPluginBase } from '../src/interface';
3+
import * as vanilla from '../src/vanilla';
4+
import { UrlService } from '../src/url/urlService';
55

66
export class TestingPlugin extends UIRouterPluginBase {
7-
name: string = 'testing';
8-
errorsCount: number = 0;
9-
errorsThreshold: number = 1000;
7+
name = 'testing';
8+
errorsCount = 0;
9+
errorsThreshold = 1000;
1010

1111
constructor(public router: UIRouter) {
1212
super();
@@ -28,7 +28,7 @@ export class TestingPlugin extends UIRouterPluginBase {
2828
}
2929

3030
addErrorLoopHandler() {
31-
let $transitions = this.router.transitionService;
31+
const $transitions = this.router.transitionService;
3232
$transitions.onCreate({}, trans => {
3333
trans.promise.catch(() => this.errorsCount++);
3434
if (this.errorsCount > this.errorsThreshold) {

test/commonSpec.ts

+33-33
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
2-
defaults, filter, is, eq, not, pattern, val, isInjectable
3-
} from "../src/index";
2+
defaults, filter, is, eq, not, pattern, val, isInjectable,
3+
} from '../src/index';
44
import { map, mapObj, pick } from '../src/common/common';
55

66
describe('common', function() {
77
describe('filter', function() {
8-
it("should filter arrays", function() {
9-
var input = [ 1, 2, 3, 4, 5 ];
10-
var filtered = filter(input, function(int) { return int > 2; });
8+
it('should filter arrays', function() {
9+
const input = [ 1, 2, 3, 4, 5 ];
10+
const filtered = filter(input, function(int) { return int > 2; });
1111
expect(filtered.length).toBe(3);
1212
expect(filtered).toEqual([ 3, 4, 5 ]);
1313
});
@@ -16,35 +16,35 @@ describe('common', function() {
1616
expect(filter([0, 1, 0, 2, 0, 3, 4], function(v) { return !!v; })).toEqual([1, 2, 3, 4]);
1717
});
1818

19-
it("should filter objects", function() {
20-
var input = { foo: 1, bar: 2, baz: 3, qux: 4 };
21-
var filtered = filter(input, function(val, key) { return val > 2; });
19+
it('should filter objects', function() {
20+
const input = { foo: 1, bar: 2, baz: 3, qux: 4 };
21+
const filtered = filter(input, function(val, key) { return val > 2; });
2222
expect(Object.keys(filtered).length).toBe(2);
2323
expect(filtered).toEqual({ baz: 3, qux: 4 });
2424
});
2525
});
2626

2727
describe('defaults', function() {
2828
it('should do left-associative object merge', function() {
29-
var options = { param1: "new val" };
30-
var result = defaults(options, {
31-
param1: "default val",
32-
param2: "default val 2"
29+
const options = { param1: 'new val' };
30+
const result = defaults(options, {
31+
param1: 'default val',
32+
param2: 'default val 2',
3333
});
34-
expect(result).toEqual({ param1: "new val", param2: "default val 2" });
34+
expect(result).toEqual({ param1: 'new val', param2: 'default val 2' });
3535
});
3636

3737
it('should whitelist keys present in default values', function() {
38-
var options = { param1: 1, param2: 2, param3: 3 };
39-
var result = defaults(options, {
38+
const options = { param1: 1, param2: 2, param3: 3 };
39+
const result = defaults(options, {
4040
param1: 0,
41-
param2: 0
41+
param2: 0,
4242
});
4343
expect(result).toEqual({ param1: 1, param2: 2 });
4444
});
4545

4646
it('should return an object when passed an empty value', function() {
47-
var vals = { param1: 0, param2: 0 }
47+
const vals = { param1: 0, param2: 0 };
4848
expect(defaults(null, vals)).toEqual(vals);
4949
expect(defaults(undefined, vals)).toEqual(vals);
5050
});
@@ -54,7 +54,7 @@ describe('common', function() {
5454
it('should allow double-negatives', function() {
5555
function T() { return true; }
5656
function F() { return false; }
57-
function empty(): boolean { return <any> ""; }
57+
function empty(): boolean { return <any> ''; }
5858

5959
expect(not(not(T))()).toBe(true);
6060
expect(not(not(F))()).toBe(false);
@@ -64,7 +64,7 @@ describe('common', function() {
6464

6565
describe('val', function() {
6666
it('should return identity', function() {
67-
var f = function() {}, foo = {};
67+
const f = function() {}, foo = {};
6868
expect(val(f)()).toBe(f);
6969
expect(val(foo)()).toBe(foo);
7070
expect(val(true)()).toBe(true);
@@ -75,18 +75,18 @@ describe('common', function() {
7575

7676
describe('pattern', function() {
7777
it('should return the result of a paired function when a condition function returns true', function() {
78-
var typeChecker = pattern([
79-
[is(Number), val("number!")],
80-
[is(String), val("string!")],
81-
[is(Boolean), val("boolean!")],
82-
[eq(null), val("null!")]
78+
const typeChecker = pattern([
79+
[is(Number), val('number!')],
80+
[is(String), val('string!')],
81+
[is(Boolean), val('boolean!')],
82+
[eq(null), val('null!')],
8383
]);
8484

85-
expect(typeChecker(1)).toBe("number!");
86-
expect(typeChecker("foo!")).toBe("string!");
87-
expect(typeChecker(true)).toBe("boolean!");
88-
expect(typeChecker(false)).toBe("boolean!");
89-
expect(typeChecker(null)).toBe("null!");
85+
expect(typeChecker(1)).toBe('number!');
86+
expect(typeChecker('foo!')).toBe('string!');
87+
expect(typeChecker(true)).toBe('boolean!');
88+
expect(typeChecker(false)).toBe('boolean!');
89+
expect(typeChecker(null)).toBe('null!');
9090
expect(typeChecker(undefined)).toBe(undefined);
9191
});
9292
});
@@ -109,20 +109,20 @@ describe('common', function() {
109109
});
110110

111111
it('should accept ng1 array notation', function() {
112-
var fn = ['foo', 'bar', function(foo, bar) {}];
112+
const fn = ['foo', 'bar', function(foo, bar) {}];
113113
expect(isInjectable(fn)).toBeTruthy();
114114
});
115115
});
116116

117117
describe('pick', () => {
118118
it('should pick inherited properties', () => {
119-
let parent = { foo: 'foo', bar: 'bar' };
120-
let child = Object.create(parent);
119+
const parent = { foo: 'foo', bar: 'bar' };
120+
const child = Object.create(parent);
121121
expect(pick(child, ['foo'])).toEqual({ foo: 'foo' });
122122
});
123123

124124
it('should not pick missing properties', () => {
125-
let obj = { foo: 'foo', bar: 'bar' };
125+
const obj = { foo: 'foo', bar: 'bar' };
126126
expect(pick(obj, ['baz'])).toEqual({ });
127127
});
128128
});

test/globSpec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import {Glob} from "../src/common/glob";
1+
import { Glob } from '../src/common/glob';
22

33
describe('Glob', function() {
44
it('should match exact strings', function() {
5-
var state = 'about.person.item';
5+
let state = 'about.person.item';
66

77
expect(new Glob('about.person.item').matches(state)).toBe(true);
88
expect(new Glob('about.person.item.foo').matches(state)).toBe(false);
99
expect(new Glob('foo.about.person.item').matches(state)).toBe(false);
1010
});
1111

1212
it('with a single wildcard (*) should match a top level state', function() {
13-
var glob = new Glob('*');
13+
let glob = new Glob('*');
1414

1515
expect(glob.matches('foo')).toBe(true);
1616
expect(glob.matches('bar')).toBe(true);
@@ -20,7 +20,7 @@ describe('Glob', function() {
2020
});
2121

2222
it('with a single wildcard (*) should match any single non-empty segment', function() {
23-
var state = 'about.person.item';
23+
let state = 'about.person.item';
2424

2525
expect(new Glob('*.person.item').matches(state)).toBe(true);
2626
expect(new Glob('*.*.item').matches(state)).toBe(true);
@@ -34,15 +34,15 @@ describe('Glob', function() {
3434
});
3535

3636
it('with a double wildcard (**) should match any valid state name', function() {
37-
var glob = new Glob('**');
37+
let glob = new Glob('**');
3838

3939
expect(glob.matches('foo')).toBe(true);
4040
expect(glob.matches('bar')).toBe(true);
4141
expect(glob.matches('foo.bar')).toBe(true);
4242
});
4343

4444
it('with a double wildcard (**) should match zero or more segments', function() {
45-
var state = 'about.person.item';
45+
let state = 'about.person.item';
4646

4747
expect(new Glob('**').matches(state)).toBe(true);
4848
expect(new Glob('**.**').matches(state)).toBe(true);

0 commit comments

Comments
 (0)