mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
filter getEntity(Multiple)Properties entities unitTest
This commit is contained in:
parent
80beb6c444
commit
e266e2ebbf
1 changed files with 45 additions and 0 deletions
|
@ -72,4 +72,49 @@ describe('Entity', function() {
|
||||||
props = Entities.getEntityProperties(boxEntity);
|
props = Entities.getEntityProperties(boxEntity);
|
||||||
expect(props.lastEdited).toBeGreaterThan(prevLastEdited);
|
expect(props.lastEdited).toBeGreaterThan(prevLastEdited);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("filtering getEntityProperties seems to work correctly", function() {
|
||||||
|
var properties = Entities.getEntityProperties(boxEntity, 'position');
|
||||||
|
expect(properties.id).toBe(boxEntity);
|
||||||
|
expect(properties.type).toBe(boxProps.type);
|
||||||
|
expect(properties.position).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("filtering getMultipleEntityProperties seems to work correctly", function () {
|
||||||
|
var sphereProps = {
|
||||||
|
type: 'Sphere',
|
||||||
|
color: {
|
||||||
|
red: 255,
|
||||||
|
green: 255,
|
||||||
|
blue: 255,
|
||||||
|
},
|
||||||
|
position: center,
|
||||||
|
dimensions: {
|
||||||
|
x: 1,
|
||||||
|
y: 1,
|
||||||
|
z: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
var sphereEntity = Entities.addEntity(sphereProps);
|
||||||
|
|
||||||
|
var entityIDs = [boxEntity, sphereEntity];
|
||||||
|
var filterTypes = 'type';
|
||||||
|
var propertySets = Entities.getMultipleEntityProperties(entityIDs, filterTypes);
|
||||||
|
expect(propertySets.length).toBe(entityIDs.length);
|
||||||
|
expect(propertySets[0].type).toBe(boxProps.type);
|
||||||
|
expect(Object.keys(propertySets[0]).length).toBe(1);
|
||||||
|
expect(propertySets[1].type).toBe(sphereProps.type);
|
||||||
|
expect(Object.keys(propertySets[1]).length).toBe(1);
|
||||||
|
|
||||||
|
filterTypes = ['id', 'type'];
|
||||||
|
propertySets = Entities.getMultipleEntityProperties(entityIDs, filterTypes);
|
||||||
|
expect(propertySets.length).toBe(entityIDs.length);
|
||||||
|
expect(Object.keys(propertySets[0]).length).toBe(filterTypes.length);
|
||||||
|
expect(propertySets[0].type).toBe(boxProps.type);
|
||||||
|
expect(Object.keys(propertySets[1]).length).toBe(filterTypes.length);
|
||||||
|
expect(propertySets[1].type).toBe(sphereProps.type);
|
||||||
|
|
||||||
|
Entities.deleteEntity(sphereEntity);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue