Add timeline death events

This commit is contained in:
dahyeon committed 2026-07-02 23:43:09 -07:00
1 parent d35843a8e2
commit df0e43d884
5 files changed
+528 -12

No files matched your search

@@ -88,6 +88,30 @@ function createTimelinePayload(
};
}
function createTimelinePayloadWithFrames(
matchId = 'KR_1',
frames: Array<{
timestamp?: number;
events?: Record<string, unknown>[];
participantFrames?: Record<string, unknown>;
}> = [],
) {
return {
metadata: {
matchId,
participants: ['target-puuid', 'ally-puuid'],
},
info: {
frameInterval: 60_000,
frames: frames.map((frame, index) => ({
timestamp: frame.timestamp ?? index * 60_000,
events: frame.events ?? [],
participantFrames: frame.participantFrames ?? {},
})),
},
};
}
interface ExecQuery<T> {
exec: jest.Mock<Promise<T>, []>;
}
@@ -375,21 +399,46 @@ describe('AnalysisPipelineService', () => {
});
it('stores derived timeline data when a timeline is available', async () => {
const timeline = createTimelinePayload('KR_1', [
const timeline = createTimelinePayloadWithFrames('KR_1', [
{
type: 'CHAMPION_KILL',
timestamp: 0,
participantFrames: {
'1': { position: { x: 4_020, y: 6_000 } },
'6': { position: { x: 3_000, y: 6_000 } },
'7': { position: { x: 8_000, y: 6_000 } },
},
},
{
timestamp: 10_000,
killerId: 1,
victimId: 6,
assistingParticipantIds: [2],
position: { x: 1_000, y: 1_000 },
events: [
{
type: 'CHAMPION_KILL',
timestamp: 10_000,
killerId: 1,
victimId: 6,
assistingParticipantIds: [2],
},
],
},
{
timestamp: 60_000,
participantFrames: {
'1': { position: { x: 4_020, y: 6_000 } },
'6': { position: { x: 9_000, y: 6_000 } },
'7': { position: { x: 14_000, y: 6_000 } },
},
},
{
type: 'ELITE_MONSTER_KILL',
timestamp: 900_000,
killerId: 4,
killerTeamId: 100,
monsterType: 'DRAGON',
events: [
{
type: 'ELITE_MONSTER_KILL',
timestamp: 900_000,
killerId: 4,
killerTeamId: 100,
monsterType: 'DRAGON',
},
],
},
]);
const getMatchTimeline = jest
@@ -433,6 +482,17 @@ describe('AnalysisPipelineService', () => {
participantIds: [4],
},
],
deathEvents: [
{
t: 10_000,
victimParticipantId: 6,
x: 4_000,
y: 6_000,
zone: 'southWestJungle',
shutdownBountyGiven: 0,
nearestAllyDistanceApprox: 5_000,
},
],
objectiveWindows: [
{
objectiveTimeMs: 900_000,