refactor: API

This commit is contained in:
cha0s 2021-01-04 06:44:32 -06:00
parent 69695f408c
commit 65474994e0
3 changed files with 6 additions and 6 deletions

View File

@ -151,10 +151,6 @@ export default (latus) => class Entity extends decorate(JsonResource) {
} }
} }
allTraitInstances() {
return this._traits;
}
allTraitTypes() { allTraitTypes() {
return Object.keys(this._traits); return Object.keys(this._traits);
} }
@ -362,4 +358,8 @@ export default (latus) => class Entity extends decorate(JsonResource) {
return this._traits[type]; return this._traits[type];
} }
get traits() {
return this._traits;
}
}; };

View File

@ -19,7 +19,7 @@ describe(name, () => {
}); });
it('has sane defaults', () => { it('has sane defaults', () => {
const entity = new Entity(); const entity = new Entity();
expect(entity.allTraitInstances()).to.deep.equal({}); expect(entity.traits).to.deep.equal({});
expect(entity.allTraitTypes()).to.deep.equal([]); expect(entity.allTraitTypes()).to.deep.equal([]);
}); });
it('can add and remove traits', async () => { it('can add and remove traits', async () => {

View File

@ -53,7 +53,7 @@ describe(name, () => {
}), }),
]); ]);
entity.destroy(); entity.destroy();
expect(entity.allTraitInstances()).to.deep.equal({}); expect(entity.traits).to.deep.equal({});
return promise; return promise;
}); });
}); });