Skip to content

Commit ef91b6a

Browse files
committed
Add entity test case
1 parent d0a4ef7 commit ef91b6a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

karma.unit.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = (config) => {
1515

1616
// list of files to exclude
1717
exclude: [
18+
'src/index.js',
1819
],
1920

2021
// preprocess matching files before serving them to the browser

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eco",
3-
"version": "0.0.0",
3+
"version": "0.1.0",
44
"description": "Entity-component-system microframework",
55
"main": "index.js",
66
"scripts": {

spec/unit/entities/entity.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ describe('Entity', () => {
2020
// this ensures the id matches the string ids used by componentCollection
2121
expect(entity.getId()).toBe('100');
2222
});
23+
24+
[null, true, false, {}, function foo() {}, 'string', []].forEach((nonNumber) => {
25+
it('should return a non-numeric id as-is', () => {
26+
const testEntity = new Entity(nonNumber);
27+
expect(testEntity.getId()).toBe(nonNumber);
28+
});
29+
});
2330
});
2431

2532
describe('get()', () => {

0 commit comments

Comments
 (0)