forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkerSidebar.test.js
50 lines (41 loc) · 1.38 KB
/
MarkerSidebar.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
import * as React from 'react';
import { Provider } from 'react-redux';
import { render, act } from 'firefox-profiler/test/fixtures/testing-library';
import { MarkerSidebar } from '../../components/sidebar/MarkerSidebar';
import { changeSelectedMarker } from '../../actions/profile-view';
import { storeWithProfile } from '../fixtures/stores';
import { getMarkerTableProfile } from '../fixtures/profiles/processed-profile';
describe('MarkerSidebar', function () {
function setup() {
const profile = getMarkerTableProfile();
const store = storeWithProfile(profile);
const renderResult = render(
<Provider store={store}>
<MarkerSidebar />
</Provider>
);
return {
...renderResult,
...store,
profile,
};
}
it('matches the snapshots when displaying data about the currently selected node', () => {
const { dispatch, profile, container } = setup();
act(() => {
dispatch(
changeSelectedMarker(
0,
profile.threads[0].markers.data.findIndex(
(data) => data && data.type === 'IPC'
)
)
);
});
expect(container.firstChild).toMatchSnapshot();
});
});