Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('ViewportFlyToInterpolator#interpolateProps', t => {
const interpolator = new ViewportFlyToInterpolator();
TEST_CASES.filter(testCase => testCase.transition).forEach(testCase => {
Object.keys(testCase.transition).forEach(time => {
const propsInTransition = interpolator.interpolateProps(
testCase.expect.start,
testCase.expect.end,
Number(time)
);
t.deepEqual(toLowPrecision(propsInTransition, 7), testCase.transition[time], time);
});
});
t.end();
});
test('ViewportFlyToInterpolator#initializeProps', t => {
const interpolator = new ViewportFlyToInterpolator();
TEST_CASES.forEach(testCase => {
const getResult = () => interpolator.initializeProps(testCase.startProps, testCase.endProps);
if (testCase.shouldThrow) {
t.throws(getResult, testCase.title);
} else {
t.deepEqual(getResult(), testCase.expect, testCase.title);
}
});
t.end();
});
DURATION_TEST_CASES.forEach(testCase => {
const interpolator = new ViewportFlyToInterpolator(testCase.opts);
t.equal(
toLowPrecision(
interpolator.getDuration(START_PROPS, Object.assign({}, END_PROPS, testCase.endProps)),
7
),
testCase.expected,
`${testCase.title}: should receive correct duration`
);
});
t.end();