redux-devtools/extension/test/perf/send.spec.js
renovate[bot] 922985f9ea
chore(deps): update dependency prettier to v3 (#1434)
* chore(deps): update dependency prettier to v3

* Format

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nathan Bierema <nbierema@gmail.com>
2023-07-12 18:03:20 +00:00

26 lines
724 B
JavaScript

import '@babel/polyfill';
import { bigArray, bigString, circularData } from './data';
import { listenMessage } from '../utils/inject';
import '../../src/browser/extension/inject/pageScript';
function test(title, data, maxTime = 100) {
it('should send ' + title, async () => {
const start = new Date();
await listenMessage(() => {
window.__REDUX_DEVTOOLS_EXTENSION__.send(
{ type: 'TEST_ACTION', data },
data,
);
});
const ms = new Date() - start;
// console.log(ms);
expect(ms).toBeLessThan(maxTime);
});
}
describe('Perf', () => {
test('a huge string', bigString);
test('a huge array', bigArray);
test('an object with circular references', circularData);
});