Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Nov 16, 2020
1 parent 04a8a74 commit aac319b
Showing 1 changed file with 49 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('geo_threshold', () => {
});

describe('getMovedEntities', () => {
const trackingEvent = 'entered';
it('should return empty array if only movements were within same shapes', async () => {
const currLocationArr = [
{
Expand Down Expand Up @@ -92,7 +91,7 @@ describe('geo_threshold', () => {
shapeLocationId: 'sameShape2',
},
];
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, trackingEvent);
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'entered');
expect(movedEntities).toEqual([]);
});

Expand Down Expand Up @@ -129,7 +128,7 @@ describe('geo_threshold', () => {
shapeLocationId: 'thisOneDidntMove',
},
];
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, trackingEvent);
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'entered');
expect(movedEntities.length).toEqual(1);
});

Expand All @@ -152,7 +151,7 @@ describe('geo_threshold', () => {
shapeLocationId: 'oldShapeLocation',
},
];
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, trackingEvent);
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'entered');
expect(movedEntities).toEqual([]);
});

Expand All @@ -178,5 +177,51 @@ describe('geo_threshold', () => {
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'exited');
expect(movedEntities).toEqual([]);
});

it('should not ignore "crossed" results from "other"', async () => {
const currLocationArr = [
{
dateInShape: '2020-09-28T18:01:41.190Z',
docId: 'N-ng1XQB6yyY-xQxnGSM',
entityName: '936',
location: [-82.8814151789993, 41.62806099653244],
shapeLocationId: 'newShapeLocation',
},
];
const prevLocationArr = [
{
dateInShape: '2020-08-28T18:01:41.190Z',
docId: 'N-ng1XQB6yyY-xQxnGSM',
entityName: '936',
location: [-82.8814151789993, 40.62806099653244],
shapeLocationId: OTHER_CATEGORY,
},
];
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'crossed');
expect(movedEntities.length).toEqual(1);
});

it('should not ignore "crossed" results to "other"', async () => {
const currLocationArr = [
{
dateInShape: '2020-08-28T18:01:41.190Z',
docId: 'N-ng1XQB6yyY-xQxnGSM',
entityName: '936',
location: [-82.8814151789993, 40.62806099653244],
shapeLocationId: OTHER_CATEGORY,
},
];
const prevLocationArr = [
{
dateInShape: '2020-09-28T18:01:41.190Z',
docId: 'N-ng1XQB6yyY-xQxnGSM',
entityName: '936',
location: [-82.8814151789993, 41.62806099653244],
shapeLocationId: 'newShapeLocation',
},
];
const movedEntities = getMovedEntities(currLocationArr, prevLocationArr, 'crossed');
expect(movedEntities.length).toEqual(1);
});
});
});

0 comments on commit aac319b

Please sign in to comment.