Fix research complete notification using raw ID instead of display name
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -122,8 +122,11 @@ describe('processTick', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const result = processTick(state);
|
const result = processTick(state);
|
||||||
const notifications = (result as Record<string, unknown>)['_notifications'] as Array<{ title: string }>;
|
const notifications = (result as Record<string, unknown>)['_notifications'] as Array<{ title: string; message: string }>;
|
||||||
expect(notifications.some(n => n.title === 'Research Complete')).toBe(true);
|
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');
|
expect(result.research!.completedResearch).toContain('advanced-cooling');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,12 @@ export function processTick(state: GameState): Partial<GameState> {
|
|||||||
const researchResult = processResearch(snap, compute);
|
const researchResult = processResearch(snap, compute);
|
||||||
|
|
||||||
if (researchResult.researchCompleted) {
|
if (researchResult.researchCompleted) {
|
||||||
|
const completedNode = TECH_TREE.find(n => n.id === researchResult.researchCompleted);
|
||||||
notifications.push({
|
notifications.push({
|
||||||
title: 'Research Complete',
|
title: 'Research Complete',
|
||||||
message: `${researchResult.researchCompleted} has been unlocked!`,
|
message: `${completedNode?.name ?? researchResult.researchCompleted} has been unlocked!`,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
|
||||||
const completedNode = TECH_TREE.find(n => n.id === researchResult.researchCompleted);
|
|
||||||
if (completedNode) {
|
if (completedNode) {
|
||||||
for (const effect of completedNode.effects) {
|
for (const effect of completedNode.effects) {
|
||||||
if (effect.type === 'unlock_product_line') {
|
if (effect.type === 'unlock_product_line') {
|
||||||
|
|||||||
Reference in New Issue
Block a user