Warning, /firebird/firebird-ng/src/app/model/box-tracker-hit.component.factory.spec.ts is written in an unsupported language. File is not indexed.
0001 // box-tracker-hit.component.factory.spec.ts
0002
0003 import { BoxTrackerHitComponentFactory, BoxTrackerHitComponent } from './box-tracker-hit.component';
0004 import { EntryComponent } from './entry-component';
0005
0006 describe('BoxTrackerHitComponentFactory', () => {
0007 const factory = new BoxTrackerHitComponentFactory();
0008
0009 it('should have the correct type', () => {
0010 expect(factory.type).toBe('BoxTrackerHit');
0011 });
0012
0013 it('should create a BoxTrackerHitComponent from DexObject', () => {
0014 const dexObject = {
0015 name: 'TestComponent',
0016 type: 'BoxTrackerHit',
0017 originType: 'TestOriginType',
0018 hits: [
0019 {
0020 pos: [1, 2, 3],
0021 dim: [10, 10, 1],
0022 t: [4, 1],
0023 ed: [0.001, 0.0001],
0024 },
0025 {
0026 pos: [4, 5, 6],
0027 dim: [10, 10, 2],
0028 t: [5, 1],
0029 ed: [0.002, 0.0002],
0030 },
0031 ],
0032 };
0033
0034 const component = factory.fromDexObject(dexObject) as BoxTrackerHitComponent;
0035
0036 expect(component).toBeInstanceOf(BoxTrackerHitComponent);
0037 expect(component.name).toBe('TestComponent');
0038 expect(component.type).toBe('BoxTrackerHit');
0039 expect(component.originType).toBe('TestOriginType');
0040 expect(component.hits.length).toBe(2);
0041
0042 const hit1 = component.hits[0];
0043 expect(hit1.position).toEqual([1, 2, 3]);
0044 expect(hit1.dimensions).toEqual([10, 10, 1]);
0045 expect(hit1.time).toEqual([4, 1]);
0046 expect(hit1.energyDeposit).toEqual([0.001, 0.0001]);
0047
0048 const hit2 = component.hits[1];
0049 expect(hit2.position).toEqual([4, 5, 6]);
0050 expect(hit2.dimensions).toEqual([10, 10, 2]);
0051 expect(hit2.time).toEqual([5, 1]);
0052 expect(hit2.energyDeposit).toEqual([0.002, 0.0002]);
0053 });
0054 });