2020-10-26 15:18:23 +03:00
|
|
|
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 },
|
2023-07-12 21:03:20 +03:00
|
|
|
data,
|
2020-10-26 15:18:23 +03:00
|
|
|
);
|
|
|
|
});
|
|
|
|
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);
|
|
|
|
});
|