mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-27 20:13:56 +03:00
b82de74592
* Use rollup for d3tooltip * Use rollup for map2tree * Set moduleResolution * Use rollup for d3-state-visualizer * Use rollup for react-base16-styling * Use rollup for react-dock * Use rollup for react-json-tree * Use rollup for redux-devtools * Use rollup for redux-devtools-intrument * Use rollup for redux-devtools-chart-monitor * Update export * Use rollup for redux-devtools-dock-monitor * Use rollup for redux-devtools-inspector-monitor * Fix inspector demo * Fix invalid eslint config * Use rollup for inspector-monitor-test-tab * Use rollup for inspector-monitor-trace-tab * Use rollup for redux-devtools-log-monitor * Use rollup for redux-devtools-remote * Use rollup in redux-devtools-rtk-query-monitor * Use rollup for redux-devtools-serialize * Fix redux-devtools examples * Use rollup for redux-devtools-slider-monitor * Fix slider examples * Use rollup for redux-devtools-ui * Use rollup for redux-devtools-utils * Use rollup for redux-devtools-extension * Use rollup for redux-devtools-app * Fix Webpack app build * Fix extension build * Turn on minimization * Update CLI
75 lines
1.9 KiB
TypeScript
75 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import { Provider } from 'react-redux';
|
|
import { createStore, applyMiddleware } from 'redux';
|
|
import { render, screen, within } from '@testing-library/react';
|
|
import App from '../src/containers/App';
|
|
import { api } from '../src/middlewares/api';
|
|
import { exportStateMiddleware } from '../src/middlewares/exportState';
|
|
import { rootReducer } from '../src/reducers';
|
|
import { DATA_TYPE_KEY } from '../src/constants/dataTypes';
|
|
import { stringifyJSON } from '../src/utils/stringifyJSON';
|
|
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: jest.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // deprecated
|
|
removeListener: jest.fn(), // deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
})),
|
|
});
|
|
|
|
const store = createStore(
|
|
rootReducer,
|
|
applyMiddleware(exportStateMiddleware, api)
|
|
);
|
|
|
|
describe('App container', () => {
|
|
it("should render inspector monitor's wrapper", () => {
|
|
render(
|
|
<Provider store={store}>
|
|
<App />
|
|
</Provider>
|
|
);
|
|
expect(screen.getByTestId('inspector')).toBeDefined();
|
|
});
|
|
|
|
it('should contain an empty action list', () => {
|
|
render(
|
|
<Provider store={store}>
|
|
<App />
|
|
</Provider>
|
|
);
|
|
const actionList = screen.getByTestId('actionList');
|
|
expect(
|
|
within(actionList).getByTestId('actionListRows')
|
|
).toBeEmptyDOMElement();
|
|
});
|
|
});
|
|
|
|
describe('stringifyJSON', () => {
|
|
it('should not mutate the source object', () => {
|
|
const src = {
|
|
isTest: true,
|
|
[DATA_TYPE_KEY]: 'Test',
|
|
};
|
|
|
|
const result = {
|
|
data: {
|
|
isTest: true,
|
|
},
|
|
__serializedType__: 'Test',
|
|
};
|
|
|
|
expect(stringifyJSON(src, true)).toEqual(JSON.stringify(result));
|
|
expect(src).toEqual({
|
|
isTest: true,
|
|
[DATA_TYPE_KEY]: 'Test',
|
|
});
|
|
});
|
|
});
|