@@ -87,7 +87,7 @@ describe("computeGeneratorTooltipData", () => {
8787 it ( "returns correct name and icon" , ( ) => {
8888 const data = computeGeneratorTooltipData ( neuralNotepad , 0 , { } ) ;
8989 expect ( data . name ) . toBe ( "Neural Notepad" ) ;
90- expect ( data . icon ) . toBe ( "\uD83D\uDCDD " ) ;
90+ expect ( data . icon ) . toBe ( "📝 " ) ;
9191 } ) ;
9292
9393 it ( "effectiveTdPerUnit equals baseTdPerUnit when no multipliers apply" , ( ) => {
@@ -104,4 +104,85 @@ describe("computeGeneratorTooltipData", () => {
104104 data . effectiveTdPerUnit * data . owned ,
105105 ) ;
106106 } ) ;
107+
108+ // ── Delta TD/s tests ──────────────────────────────────────────────────────
109+
110+ describe ( "deltaTdPerSecond" , ( ) => {
111+ it ( "equals baseTdPerSecond for the first unit (0 → 1)" , ( ) => {
112+ // 0 owned → 1 owned, no milestone yet: delta = 0.2 * 1 * 1 - 0 = 0.2
113+ const data = computeGeneratorTooltipData ( neuralNotepad , 0 , { } ) ;
114+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 0.2 ) ;
115+ expect ( data . milestoneWillCross ) . toBe ( false ) ;
116+ } ) ;
117+
118+ it ( "equals baseTdPerSecond for a mid-range unit with no milestone (5 → 6)" , ( ) => {
119+ // No milestone active (owned < 10): delta = base * 6 * 1 - base * 5 * 1 = base
120+ const allOwned = { "neural-notepad" : 5 } ;
121+ const data = computeGeneratorTooltipData ( neuralNotepad , 5 , allOwned ) ;
122+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 0.2 ) ;
123+ expect ( data . milestoneWillCross ) . toBe ( false ) ;
124+ } ) ;
125+
126+ it ( "accounts for milestone crossing when buying the 10th unit (9 → 10)" , ( ) => {
127+ // Buying the 10th unit crosses the x1.5 milestone.
128+ // Current: 0.2 * 9 * 1 = 1.8
129+ // Future: 0.2 * 10 * 1.5 = 3.0
130+ // Delta: 3.0 - 1.8 = 1.2
131+ const allOwned = { "neural-notepad" : 9 } ;
132+ const data = computeGeneratorTooltipData ( neuralNotepad , 9 , allOwned ) ;
133+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 1.2 ) ;
134+ expect ( data . milestoneWillCross ) . toBe ( true ) ;
135+ } ) ;
136+
137+ it ( "accounts for milestone crossing when buying the 25th unit (24 → 25)" , ( ) => {
138+ // Buying the 25th unit crosses the x2 milestone.
139+ // Current: 0.2 * 24 * 1.5 = 7.2
140+ // Future: 0.2 * 25 * 2 = 10.0
141+ // Delta: 10.0 - 7.2 = 2.8
142+ const allOwned = { "neural-notepad" : 24 } ;
143+ const data = computeGeneratorTooltipData ( neuralNotepad , 24 , allOwned ) ;
144+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 2.8 ) ;
145+ expect ( data . milestoneWillCross ) . toBe ( true ) ;
146+ } ) ;
147+
148+ it ( "accounts for milestone crossing when buying the 50th unit (49 → 50)" , ( ) => {
149+ // Buying the 50th unit crosses the x3 milestone.
150+ // Current: 0.2 * 49 * 2 = 19.6
151+ // Future: 0.2 * 50 * 3 = 30.0
152+ // Delta: 30.0 - 19.6 = 10.4
153+ const allOwned = { "neural-notepad" : 49 } ;
154+ const data = computeGeneratorTooltipData ( neuralNotepad , 49 , allOwned ) ;
155+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 10.4 ) ;
156+ expect ( data . milestoneWillCross ) . toBe ( true ) ;
157+ } ) ;
158+
159+ it ( "applies normal delta after milestone (owned=10, 10 → 11)" , ( ) => {
160+ // x1.5 milestone active, no crossing.
161+ // Current: 0.2 * 10 * 1.5 = 3.0
162+ // Future: 0.2 * 11 * 1.5 = 3.3
163+ // Delta: 0.3
164+ const allOwned = { "neural-notepad" : 10 } ;
165+ const data = computeGeneratorTooltipData ( neuralNotepad , 10 , allOwned ) ;
166+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 0.3 ) ;
167+ expect ( data . milestoneWillCross ) . toBe ( false ) ;
168+ } ) ;
169+
170+ it ( "applies normal delta at max milestone (owned=100, 100 → 101)" , ( ) => {
171+ // x6 milestone active, no further milestones.
172+ // Current: 0.2 * 100 * 6 = 120.0
173+ // Future: 0.2 * 101 * 6 = 121.2
174+ // Delta: 1.2
175+ const allOwned = { "neural-notepad" : 100 } ;
176+ const data = computeGeneratorTooltipData ( neuralNotepad , 100 , allOwned ) ;
177+ expect ( data . deltaTdPerSecond ) . toBeCloseTo ( 1.2 ) ;
178+ expect ( data . milestoneWillCross ) . toBe ( false ) ;
179+ } ) ;
180+
181+ it ( "milestoneWillCross is false well before a threshold" , ( ) => {
182+ const data = computeGeneratorTooltipData ( neuralNotepad , 7 , {
183+ "neural-notepad" : 7 ,
184+ } ) ;
185+ expect ( data . milestoneWillCross ) . toBe ( false ) ;
186+ } ) ;
187+ } ) ;
107188} ) ;
0 commit comments