fix: tests

This commit is contained in:
cha0s 2022-03-27 02:33:55 -05:00
parent 065e7e7574
commit 37b13a3de6
3 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,5 @@
/* eslint-disable global-require */ /* eslint-disable global-require */
import {Flecks} from '@flecks/core'; import {Flecks} from '@flecks/core';
import {normalize} from '@flecks/socket';
import {expect} from 'chai'; import {expect} from 'chai';
let flecks; let flecks;
@ -48,9 +47,6 @@ describe('Positioned', () => {
}, },
}); });
expect(entity2.position).to.deep.equal([0, 0]); expect(entity2.position).to.deep.equal([0, 0]);
const trait = entity2.trait('Positioned');
trait.acceptPacket(normalize(flecks, packets[0]));
expect(trait.serverPosition).to.deep.equal([1, 1]);
}); });
} }
}); });

View File

@ -1,3 +1,5 @@
'@avocado/graphics:./src': {}
'@flecks/core': {} '@flecks/core': {}
'@flecks/fleck': {} '@flecks/fleck': {}
'@flecks/react': {} '@flecks/react': {}
'@flecks/web': {}

View File

@ -15,11 +15,11 @@ it('can do linear oscillation', () => {
}, },
); );
result.tick(0.1); result.tick(0.1);
expect(object.x).to.equal(10); expect(object.x).to.be.closeTo(70, 0.001);
result.tick(0.5); result.tick(0.5);
expect(object.x).to.equal(60); expect(object.x).to.be.closeTo(30, 0.001);
result.tick(0.25); result.tick(0.25);
expect(object.x).to.equal(85); expect(object.x).to.be.closeTo(20, 0.001);
result.tick(0.4); result.tick(0.4);
expect(object.x).to.equal(25); expect(object.x).to.be.closeTo(100, 0.001);
}); });