Skip to content

Commit de5093c

Browse files
rubennortefacebook-github-bot
authored andcommitted
Add test for MemoryInfo (#53052)
Summary: Pull Request resolved: #53052 Changelog: [internal] Adds a test for `performance.memory`. Reviewed By: hoxyq Differential Revision: D79633246 fbshipit-source-id: 8f9df0219de6c04c8be75af4c9d03576a8164ea9
1 parent 6b35415 commit de5093c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
import type Performance from '../Performance';
12+
13+
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
14+
15+
declare var performance: Performance;
16+
17+
describe('performance.memory', () => {
18+
it('provides memory info', () => {
19+
const memoryInfo = performance.memory;
20+
21+
expect(memoryInfo.usedJSHeapSize).toBeGreaterThan(0);
22+
expect(memoryInfo.totalJSHeapSize).toBeGreaterThan(0);
23+
});
24+
25+
it('always returns a new object', () => {
26+
expect(performance.memory).not.toBe(performance.memory);
27+
});
28+
});

0 commit comments

Comments
 (0)