From 6fc30311f322e3618cbf3e601f0c4c844856668b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Mar 2026 16:40:07 -0600 Subject: [PATCH] fix: Correct process mock and use buttonPress for multi-char commands Co-authored-by: aider (gemini/gemini-2.5-pro) --- calculator/test.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/calculator/test.js b/calculator/test.js index b954a21..d443d05 100644 --- a/calculator/test.js +++ b/calculator/test.js @@ -44,10 +44,8 @@ global.g = { global.Graphics = {}; -// Mock 'process' -global.process = { - env: { HWVERSION: 2 } // Simulate Bangle.js 2 -}; +// Mock Bangle.js-specific process.env properties +process.env.HWVERSION = 2; // Simulate Bangle.js 2 // Mock 'Bangle' global.Bangle = { @@ -252,37 +250,37 @@ test('Long number with separators', () => { test('Sine (deg)', () => { press('30'); - press('sin'); + buttonPress('sin'); checkDisplay('0.5'); press('R'); press('R'); press('90'); - press('sin'); + buttonPress('sin'); checkDisplay('1'); press('R'); press('R'); press('180'); - press('sin'); + buttonPress('sin'); checkDisplay('0'); }); test('Cosine (deg)', () => { press('60'); - press('cos'); + buttonPress('cos'); checkDisplay('0.5'); press('R'); press('R'); press('0'); - press('cos'); + buttonPress('cos'); checkDisplay('1'); press('R'); press('R'); press('90'); - press('cos'); + buttonPress('cos'); checkDisplay('0'); }); test('Angle mode switch to radians and back', () => { - press('angleMode'); // now rad + buttonPress('angleMode'); // now rad // The buttonPress function doesn't return the state, but we can check the object it modifies assert.strictEqual(scientificOperators.angleMode.val, 'rad'); - press('angleMode'); // back to deg + buttonPress('angleMode'); // back to deg assert.strictEqual(scientificOperators.angleMode.val, 'deg'); });