Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('XVIZObject#constructor', t => {
const object = new XVIZObject({id: 11, index: 0, timestamp: 1000});
t.ok(object, 'creates OBJECT object successfully');
t.is(object.id, 11, 'OBJECT object id is correct');
t.ok(object.state, 'creates state object');
t.ok(object._props, 'creates props object');
t.is(object.startTime, 1000, 'has startTime');
t.is(object.endTime, 1000, 'has endTime');
t.end();
});
test('XVIZObject#_reset, _addFeature, isValid', t => {
const object = new XVIZObject({id: 11, index: 0, timestamp: 1000});
t.not(object.isValid, 'object should be empty');
object._addFeature('/a', {});
t.not(object.isValid, 'point is not valid');
object._addFeature('/b', {center: 1});
t.not(object.isValid, 'point is not valid');
object._addFeature('/c', {center: [0, 1]});
t.deepEquals(object.position, [0, 1, 0], 'sets geometry from single point');
t.ok(object.isValid, 'object should not be empty');
t.deepEquals(Array.from(object.streamNames), ['/a', '/b', '/c'], 'gets streamNames');
object._reset();
t.not(object.isValid, 'object should be empty');
test('XVIZObject#observe', t => {
const object = new XVIZObject({id: 11, index: 0, timestamp: 1000});
object._observe(1001);
t.is(object.startTime, 1000, 'has correct startTime');
t.is(object.endTime, 1001, 'has correct endTime');
object._observe(999);
t.is(object.startTime, 999, 'has correct startTime');
t.is(object.endTime, 1001, 'has correct endTime');
t.end();
});