Test: stub os.freemem in the availableMemory fallback test (it flaked)
CI / Lint (eslint) (pull_request) Successful in 32s
CI / Test (jest) (pull_request) Successful in 33s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m54s
CI / Integration (api) (pull_request) Successful in 2m30s
CI / UI screenshots (before/after) (pull_request) Successful in 10s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-23 12:18:49 -05:00
1 parent cb2c7a10fd
commit 8698e1a4b0
1 file changed
+7 -1
+7 -1
View File
@@ -206,6 +206,12 @@ describe('availableMemory (#30)', () => {
expect(availableMemory(meminfo)).toBe(459733 * 1024); expect(availableMemory(meminfo)).toBe(459733 * 1024);
}); });
test('falls back to os.freemem() without a MemAvailable line', () => { test('falls back to os.freemem() without a MemAvailable line', () => {
expect(availableMemory('MemTotal: 1 kB\n')).toBe(require('os').freemem()); // Stubbed: free memory changes between two real calls, which made this flaky.
const spy = jest.spyOn(require('os'), 'freemem').mockReturnValue(123456);
try {
expect(availableMemory('MemTotal: 1 kB\n')).toBe(123456);
} finally {
spy.mockRestore();
}
}); });
}); });