mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 22:19:48 +03:00
Add failing test case for stringifyJSON
This commit is contained in:
parent
cd4f022671
commit
b3083e5ba5
|
@ -7,6 +7,8 @@ import App from '../src/app/containers/App';
|
|||
import api from '../src/app/middlewares/api';
|
||||
import exportState from '../src/app/middlewares/exportState';
|
||||
import rootReducer from '../src/app/reducers';
|
||||
import { DATA_TYPE_KEY } from '../src/app/constants/dataTypes';
|
||||
import stringifyJSON from '../src/app/utils/stringifyJSON';
|
||||
|
||||
let wrapper;
|
||||
|
||||
|
@ -43,3 +45,25 @@ describe('App container', () => {
|
|||
).toMatch(/<div class="actionListRows-\d-\d-\d+"><\/div>/);
|
||||
});
|
||||
});
|
||||
|
||||
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',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user