From 6105c2888734c8f1b0480a9282ec71c2df1da01a Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Sun, 26 Apr 2026 12:22:17 -0400 Subject: [PATCH] Fix research complete notification using raw ID instead of display name Co-Authored-By: Claude Opus 4.6 --- packages/game-engine/src/tick.test.ts | 7 +++++-- packages/game-engine/src/tick.ts | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/game-engine/src/tick.test.ts b/packages/game-engine/src/tick.test.ts index 07d3468..c593783 100644 --- a/packages/game-engine/src/tick.test.ts +++ b/packages/game-engine/src/tick.test.ts @@ -122,8 +122,11 @@ describe('processTick', () => { }, }); const result = processTick(state); - const notifications = (result as Record)['_notifications'] as Array<{ title: string }>; - expect(notifications.some(n => n.title === 'Research Complete')).toBe(true); + const notifications = (result as Record)['_notifications'] as Array<{ title: string; message: string }>; + const researchNotif = notifications.find(n => n.title === 'Research Complete'); + expect(researchNotif).toBeDefined(); + expect(researchNotif!.message).toContain('Advanced Cooling'); + expect(researchNotif!.message).not.toContain('advanced-cooling'); expect(result.research!.completedResearch).toContain('advanced-cooling'); }); diff --git a/packages/game-engine/src/tick.ts b/packages/game-engine/src/tick.ts index 6488e1e..5948640 100644 --- a/packages/game-engine/src/tick.ts +++ b/packages/game-engine/src/tick.ts @@ -66,13 +66,12 @@ export function processTick(state: GameState): Partial { const researchResult = processResearch(snap, compute); if (researchResult.researchCompleted) { + const completedNode = TECH_TREE.find(n => n.id === researchResult.researchCompleted); notifications.push({ title: 'Research Complete', - message: `${researchResult.researchCompleted} has been unlocked!`, + message: `${completedNode?.name ?? researchResult.researchCompleted} has been unlocked!`, type: 'success', }); - - const completedNode = TECH_TREE.find(n => n.id === researchResult.researchCompleted); if (completedNode) { for (const effect of completedNode.effects) { if (effect.type === 'unlock_product_line') {