Put actual value first
This commit is contained in:
parent
d88f70caa2
commit
7494e286d9
1 changed files with 8 additions and 8 deletions
|
@ -1360,21 +1360,21 @@ describe('browser-window module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const assertBoundsEqual = (expect, actual) => {
|
const assertBoundsEqual = (actual, expect) => {
|
||||||
if (isIntegerScaleFactor()) {
|
if (isIntegerScaleFactor()) {
|
||||||
assert.deepEqual(expect, actual)
|
assert.deepEqual(expect, actual)
|
||||||
} else if (Array.isArray(actual)) {
|
} else if (Array.isArray(actual)) {
|
||||||
assertWithinDelta(expect[0], actual[0], 1, 'x')
|
assertWithinDelta(actual[0], expect[0], 1, 'x')
|
||||||
assertWithinDelta(expect[1], actual[1], 1, 'y')
|
assertWithinDelta(actual[1], expect[1], 1, 'y')
|
||||||
} else {
|
} else {
|
||||||
assertWithinDelta(expect.x, actual.x, 1, 'x')
|
assertWithinDelta(actual.x, expect.x, 1, 'x')
|
||||||
assertWithinDelta(expect.y, actual.y, 1, 'y')
|
assertWithinDelta(actual.y, expect.y, 1, 'y')
|
||||||
assertWithinDelta(expect.width, actual.width, 1, 'width')
|
assertWithinDelta(actual.width, expect.width, 1, 'width')
|
||||||
assertWithinDelta(expect.height, actual.height, 1, 'height')
|
assertWithinDelta(actual.height, expect.height, 1, 'height')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const assertWithinDelta = (expect, actual, delta, label) => {
|
const assertWithinDelta = (actual, expect, delta, label) => {
|
||||||
const result = Math.abs(actual[0] - expect[0])
|
const result = Math.abs(actual[0] - expect[0])
|
||||||
assert.ok(result <= delta, `${label} value of ${expect} was not within ${delta} of ${actual}`)
|
assert.ok(result <= delta, `${label} value of ${expect} was not within ${delta} of ${actual}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue