aboutsummaryrefslogtreecommitdiff
path: root/webAO/__tests__/isLowMemory.test.ts
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2026-01-01 16:56:51 +0100
committerGitHub <noreply@github.com>2026-01-01 16:56:51 +0100
commit33744e44ceaf3825da451ba38281fd84b255de80 (patch)
treee6c080d7e8e6f56652c2269a380eff40b899a065 /webAO/__tests__/isLowMemory.test.ts
parente07fe372bc20d16eb590b68ed256007312b3801a (diff)
parent01ecb948edb015613e05bc2b6da4021137957745 (diff)
Merge pull request #286 from AttorneyOnline/bnnuy
Bnnuy
Diffstat (limited to 'webAO/__tests__/isLowMemory.test.ts')
-rw-r--r--webAO/__tests__/isLowMemory.test.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/webAO/__tests__/isLowMemory.test.ts b/webAO/__tests__/isLowMemory.test.ts
index 6428e17..870b40e 100644
--- a/webAO/__tests__/isLowMemory.test.ts
+++ b/webAO/__tests__/isLowMemory.test.ts
@@ -1,11 +1,31 @@
import { isLowMemory } from '../client/isLowMemory';
import { setOldLoading } from '../client';
+import { AO_HOST, setAOhost } from '../client/aoHost';
-// Mock the setOldLoading function
+// Mock the setOldLoading function and prevent any network requests
jest.mock('../client', () => ({
setOldLoading: jest.fn(),
}));
+// Mock any potential network requests
+jest.mock('../services/request', () => ({
+ __esModule: true,
+ default: jest.fn().mockResolvedValue(''),
+ request: jest.fn().mockResolvedValue(''),
+ requestBuffer: jest.fn().mockResolvedValue(new ArrayBuffer(0)),
+}));
+
+// Mock the fileExists function to prevent network requests
+jest.mock('../utils/fileExists', () => ({
+ __esModule: true,
+ default: jest.fn().mockResolvedValue(false),
+}));
+
+// Set AO_HOST to a valid URL before tests run
+beforeAll(() => {
+ setAOhost('https://example.com/');
+});
+
describe('isLowMemory', () => {
beforeEach(() => {
// Reset mock before each test to ensure isolation