Remove some linter-skipping

This commit is contained in:
David Evans 2018-05-04 22:51:01 +01:00
parent e32a54e03a
commit 73cc61d430
6 changed files with 66 additions and 54 deletions

View File

@ -1463,19 +1463,19 @@
class AgentState { class AgentState {
constructor({ constructor({
visible = false,
locked = false,
blocked = false, blocked = false,
highlighted = false,
group = null,
covered = false, covered = false,
group = null,
highlighted = false,
locked = false,
visible = false,
} = {}) { } = {}) {
this.visible = visible;
this.locked = locked;
this.blocked = blocked; this.blocked = blocked;
this.highlighted = highlighted;
this.group = group;
this.covered = covered; this.covered = covered;
this.group = group;
this.highlighted = highlighted;
this.locked = locked;
this.visible = visible;
} }
} }
AgentState.LOCKED = new AgentState({locked: true}); AgentState.LOCKED = new AgentState({locked: true});
@ -2494,8 +2494,8 @@
agent: agents[0], agent: agents[0],
ln: 0, ln: 0,
options, options,
tag,
parallel, parallel,
tag,
}); });
this.handleConnectDelayEnd({ this.handleConnectDelayEnd({
agent: agents[1], agent: agents[1],

File diff suppressed because one or more lines are too long

View File

@ -1463,19 +1463,19 @@
class AgentState { class AgentState {
constructor({ constructor({
visible = false,
locked = false,
blocked = false, blocked = false,
highlighted = false,
group = null,
covered = false, covered = false,
group = null,
highlighted = false,
locked = false,
visible = false,
} = {}) { } = {}) {
this.visible = visible;
this.locked = locked;
this.blocked = blocked; this.blocked = blocked;
this.highlighted = highlighted;
this.group = group;
this.covered = covered; this.covered = covered;
this.group = group;
this.highlighted = highlighted;
this.locked = locked;
this.visible = visible;
} }
} }
AgentState.LOCKED = new AgentState({locked: true}); AgentState.LOCKED = new AgentState({locked: true});
@ -2494,8 +2494,8 @@
agent: agents[0], agent: agents[0],
ln: 0, ln: 0,
options, options,
tag,
parallel, parallel,
tag,
}); });
this.handleConnectDelayEnd({ this.handleConnectDelayEnd({
agent: agents[1], agent: agents[1],

View File

@ -1,5 +1,4 @@
/* eslint-disable max-lines */ /* eslint-disable max-lines */
/* eslint-disable sort-keys */ // Maybe later
import { import {
flatMap, flatMap,
@ -13,19 +12,19 @@ import {
class AgentState { class AgentState {
constructor({ constructor({
visible = false,
locked = false,
blocked = false, blocked = false,
highlighted = false,
group = null,
covered = false, covered = false,
group = null,
highlighted = false,
locked = false,
visible = false,
} = {}) { } = {}) {
this.visible = visible;
this.locked = locked;
this.blocked = blocked; this.blocked = blocked;
this.highlighted = highlighted;
this.group = group;
this.covered = covered; this.covered = covered;
this.group = group;
this.highlighted = highlighted;
this.locked = locked;
this.visible = visible;
} }
} }
AgentState.LOCKED = new AgentState({locked: true}); AgentState.LOCKED = new AgentState({locked: true});
@ -1044,8 +1043,8 @@ export default class Generator {
agent: agents[0], agent: agents[0],
ln: 0, ln: 0,
options, options,
tag,
parallel, parallel,
tag,
}); });
this.handleConnectDelayEnd({ this.handleConnectDelayEnd({
agent: agents[1], agent: agents[1],

View File

@ -1,7 +1,4 @@
beforeAll(() => { function checkNear(actual, expected, range) {
jasmine.addMatchers({
toBeNear: () => ({
compare: (actual, expected, range) => {
if( if(
typeof expected !== 'number' || typeof expected !== 'number' ||
typeof range !== 'number' || typeof range !== 'number' ||
@ -14,9 +11,32 @@ beforeAll(() => {
if(typeof actual !== 'number') { if(typeof actual !== 'number') {
throw new Error('Expected a number, got ' + actual); throw new Error('Expected a number, got ' + actual);
} }
return { return Math.abs(actual - expected) <= range;
pass: Math.abs(actual - expected) <= range, }
};
beforeAll(() => {
jasmine.addMatchers({
toBeNear: () => ({
compare: (actual, expected, range) => {
if(Array.isArray(expected)) {
if(typeof actual !== 'object') {
throw new Error('Expected an array, got ' + actual);
}
if(actual.length !== expected.length) {
throw new Error(
'Expected an array of size ' + expected.length +
', got ' + actual
);
}
for(let i = 0; i < expected.length; ++ i) {
if(!checkNear(actual[i], expected[i], range)) {
return {pass: false};
}
}
return {pass: true};
}
return {pass: checkNear(actual, expected, range)};
}, },
}), }),
}); });

View File

@ -1,5 +1,3 @@
/* eslint-disable max-statements */
import ImageRegion from './ImageRegion.mjs'; import ImageRegion from './ImageRegion.mjs';
import {nodejs} from '../../scripts/core/browser.mjs'; import {nodejs} from '../../scripts/core/browser.mjs';
@ -99,15 +97,10 @@ describe('ImageRegion', () => {
expect(r.stepX).toEqual(1); expect(r.stepX).toEqual(1);
expect(r.stepY).toEqual(3); expect(r.stepY).toEqual(3);
expect(r.dim).toEqual(1); expect(r.dim).toEqual(1);
expect(r.values[0]).toBeNear(0, PRECISION); expect(r.values).toBeNear(
expect(r.values[1]).toBeNear(0, PRECISION); [0, 0, 0, -1, -1 / 3, 1, -1 / 2, -1 / 6, 1 / 2],
expect(r.values[2]).toBeNear(0, PRECISION); PRECISION
expect(r.values[3]).toBeNear(-1, PRECISION); );
expect(r.values[4]).toBeNear(-1 / 3, PRECISION);
expect(r.values[5]).toBeNear(1, PRECISION);
expect(r.values[6]).toBeNear(-1 / 2, PRECISION);
expect(r.values[7]).toBeNear(-1 / 6, PRECISION);
expect(r.values[8]).toBeNear(1 / 2, PRECISION);
}); });
}); });