Add timeline roam frames

This commit is contained in:
dahyeon committed 2026-07-02 23:50:10 -07:00
1 parent df0e43d884
commit d4e7cb6e8b
4 files changed
+296

No files matched your search

@@ -415,6 +415,148 @@ describe('TimelineDerivedService', () => {
);
});
it('builds roam frames for non-jungle laners between 8 and 14 minutes', () => {
const rawMatch = {
info: {
participants: [
{ participantId: 1, teamId: 100, teamPosition: 'TOP' },
{ participantId: 2, teamId: 100, teamPosition: 'JUNGLE' },
{ participantId: 6, teamId: 200, teamPosition: 'MIDDLE' },
],
},
};
const derived = service.buildDerivedData(
createTimelinePayloadWithFrames([
{
timestamp: 7 * 60_000,
participantFrames: {
'1': { position: { x: 8_000, y: 7_000 } },
},
},
{
timestamp: 8 * 60_000,
participantFrames: {
'1': { position: { x: 8_000, y: 7_000 } },
'2': { position: { x: 8_000, y: 7_000 } },
'6': { position: { x: 14_200, y: 14_200 } },
},
},
{
timestamp: 9 * 60_000,
participantFrames: {
'1': { position: { x: 1_000, y: 9_000 } },
'6': { position: { x: 8_000, y: 7_000 } },
},
},
{
timestamp: 14 * 60_000,
participantFrames: {
'1': { position: { x: 9_000, y: 1_000 } },
},
},
{
timestamp: 15 * 60_000,
participantFrames: {
'1': { position: { x: 8_000, y: 7_000 } },
},
},
]),
rawMatch,
);
expect(derived.roamFrames).toEqual([
{
t: 8 * 60_000,
participantId: 1,
teamId: 100,
x: 8_000,
y: 7_000,
zone: 'river',
assignedLaneZone: 'topLane',
},
{
t: 9 * 60_000,
participantId: 6,
teamId: 200,
x: 8_000,
y: 7_000,
zone: 'river',
assignedLaneZone: 'middleLane',
},
{
t: 14 * 60_000,
participantId: 1,
teamId: 100,
x: 9_000,
y: 1_000,
zone: 'bottomLane',
assignedLaneZone: 'topLane',
},
]);
});
it('uses the participant own base only when filtering roam frames', () => {
const rawMatch = {
info: {
participants: [{ participantId: 1, teamId: 100, teamPosition: 'TOP' }],
},
};
const derived = service.buildDerivedData(
createTimelinePayloadWithFrames([
{
timestamp: 8 * 60_000,
participantFrames: {
'1': { position: { x: 600, y: 600 } },
},
},
{
timestamp: 9 * 60_000,
participantFrames: {
'1': { position: { x: 14_200, y: 14_200 } },
},
},
]),
rawMatch,
);
expect(derived.roamFrames).toEqual([
{
t: 9 * 60_000,
participantId: 1,
teamId: 100,
x: 14_200,
y: 14_200,
zone: 'redBase',
assignedLaneZone: 'topLane',
},
]);
});
it('omits roam frames when participant id or map zone is unknown', () => {
const rawMatch = {
info: {
participants: [
{ teamId: 100, teamPosition: 'TOP' },
{ participantId: 2, teamId: 100, teamPosition: 'MIDDLE' },
],
},
};
const derived = service.buildDerivedData(
createTimelinePayloadWithFrames([
{
timestamp: 8 * 60_000,
participantFrames: {
'1': { position: { x: 8_000, y: 7_000 } },
'2': { position: { x: -1, y: 7_500 } },
},
},
]),
rawMatch,
);
expect(derived.roamFrames).toEqual([]);
});
it('builds weighted advantage events for kills, plates, towers, and objectives', () => {
const derived = service.buildDerivedData(
createTimelinePayload([