Warning, /firebird/firebird-ng/src/app/model/box-tracker-hit.component.spec.ts is written in an unsupported language. File is not indexed.
0001 // box-tracker-hit.component.spec.ts
0002
0003 import { BoxTrackerHitComponent, BoxTrackerHit } from './box-tracker-hit.component';
0004
0005 describe('BoxTrackerHitComponent', () => {
0006 it('should create an instance with given name', () => {
0007 const component = new BoxTrackerHitComponent('TestComponent');
0008
0009 expect(component.name).toBe('TestComponent');
0010 expect(component.type).toBe(BoxTrackerHitComponent.type);
0011 expect(component.hits.length).toBe(0);
0012 });
0013
0014 it('should serialize to DexObject correctly', () => {
0015 const hit1 = new BoxTrackerHit([1, 2, 3], [10, 10, 1], [4, 1], [0.001, 0.0001]);
0016 const hit2 = new BoxTrackerHit([4, 5, 6], [10, 10, 2], [5, 1], [0.002, 0.0002]);
0017
0018 const component = new BoxTrackerHitComponent('TestComponent', 'TestOriginType');
0019 component.hits.push(hit1, hit2);
0020
0021 const dexObject = component.toDexObject();
0022
0023 expect(dexObject).toEqual({
0024 name: 'TestComponent',
0025 type: 'BoxTrackerHit',
0026 originType: 'TestOriginType',
0027 hits: [hit1.toDexObject(), hit2.toDexObject()],
0028 });
0029 });
0030 });