Add test for MemoryInfo (#53052)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53052

Changelog: [internal]

Adds a test for `performance.memory`.

Reviewed By: hoxyq

Differential Revision: D79633246

fbshipit-source-id: 8f9df0219de6c04c8be75af4c9d03576a8164ea9
This commit is contained in:
Rubén Norte authored and Facebook GitHub Bot committed 2025-08-05 03:46:35 -07:00
1 parent 6b354155ed
commit de5093c887
1 file changed
+28
@@ -0,0 +1,28 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type Performance from '../Performance';
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
declare var performance: Performance;
describe('performance.memory', () => {
it('provides memory info', () => {
const memoryInfo = performance.memory;
expect(memoryInfo.usedJSHeapSize).toBeGreaterThan(0);
expect(memoryInfo.totalJSHeapSize).toBeGreaterThan(0);
});
it('always returns a new object', () => {
expect(performance.memory).not.toBe(performance.memory);
});
});