Skip to content

Commit bb153be

Browse files
committed
[Tests] Replace deprecated window.devToolsExtension
1 parent b8767bc commit bb153be

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Diff for: test/app/inject/api.spec.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ import { insertScript, listenMessage } from '../../utils/inject';
44
import '../../../src/browser/extension/inject/pageScript';
55

66
describe('API', () => {
7-
it('should get window.devToolsExtension function', () => {
8-
expect(window.devToolsExtension).toBeA('function');
7+
it('should get window.__REDUX_DEVTOOLS_EXTENSION__ function', () => {
8+
expect(window.__REDUX_DEVTOOLS_EXTENSION__).toBeA('function');
99
});
1010

1111
it('should notify error', () => {
1212
const spy = expect.createSpy(() => {});
13-
window.devToolsExtension.notifyErrors(spy);
13+
window.__REDUX_DEVTOOLS_EXTENSION__.notifyErrors(spy);
1414
insertScript('hi()');
1515
expect(spy).toHaveBeenCalled();
1616
});
1717

1818
it('should open monitor', async () => {
1919
let message = await listenMessage(() => {
20-
window.devToolsExtension.open();
20+
window.__REDUX_DEVTOOLS_EXTENSION__.open();
2121
});
2222
expect(message).toEqual({ source: '@devtools-page', type: 'OPEN', position: 'right' });
2323

2424
message = await listenMessage(() => {
25-
window.devToolsExtension.open('left');
25+
window.__REDUX_DEVTOOLS_EXTENSION__.open('left');
2626
});
2727
expect(message).toEqual({ source: '@devtools-page', type: 'OPEN', position: 'left' });
2828
});
2929

3030
it('should send message', async () => {
3131
let message = await listenMessage(() => {
32-
window.devToolsExtension.send('hi');
32+
window.__REDUX_DEVTOOLS_EXTENSION__.send('hi');
3333
});
3434
expect(message).toInclude({
3535
type: 'ACTION',
@@ -41,7 +41,7 @@ describe('API', () => {
4141
expect(message.action).toMatch(/{"action":{"type":"hi"},"timestamp":\d+}/);
4242

4343
message = await listenMessage(() => {
44-
window.devToolsExtension.send({ type: 'hi' }, { counter: 1 }, 1);
44+
window.__REDUX_DEVTOOLS_EXTENSION__.send({ type: 'hi' }, { counter: 1 }, 1);
4545
});
4646
expect(message).toInclude({
4747
type: 'ACTION',
@@ -53,7 +53,7 @@ describe('API', () => {
5353
expect(message.action).toMatch(/{"action":{"type":"hi"},"timestamp":\d+}/);
5454

5555
message = await listenMessage(() => {
56-
window.devToolsExtension.send({ type: 'hi' }, { counter: 1 }, 1);
56+
window.__REDUX_DEVTOOLS_EXTENSION__.send({ type: 'hi' }, { counter: 1 }, 1);
5757
});
5858
expect(message).toInclude({
5959
type: 'ACTION',
@@ -65,7 +65,7 @@ describe('API', () => {
6565
expect(message.action).toMatch(/{"action":{"type":"hi"},"timestamp":\d+}/);
6666

6767
message = await listenMessage(() => {
68-
window.devToolsExtension.send(undefined, { counter: 1 }, 1);
68+
window.__REDUX_DEVTOOLS_EXTENSION__.send(undefined, { counter: 1 }, 1);
6969
});
7070
expect(message).toEqual({
7171
action: undefined,

Diff for: test/app/inject/enhancer.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function counter(state = 0, action) {
1515
describe('Redux enhancer', () => {
1616
it('should create the store', async () => {
1717
const message = await listenMessage(() => {
18-
window.store = createStore(counter, window.devToolsExtension());
18+
window.store = createStore(counter, window.__REDUX_DEVTOOLS_EXTENSION__());
1919
expect(window.store).toBeA('object');
2020
});
2121
expect(message.type).toBe('INIT_INSTANCE');
@@ -147,7 +147,7 @@ describe('Redux enhancer', () => {
147147

148148
it('should create the store with config parameters', async () => {
149149
const message = await listenMessage(() => {
150-
window.store = createStore(counter, window.devToolsExtension({
150+
window.store = createStore(counter, window.__REDUX_DEVTOOLS_EXTENSION__({
151151
actionsBlacklist: ['SOME_ACTION'],
152152
statesFilter: state => state,
153153
serializeState: (key, value) => value
@@ -159,7 +159,7 @@ describe('Redux enhancer', () => {
159159

160160
it('should create the store using old Redux api', async () => {
161161
const message = await listenMessage(() => {
162-
window.store = window.devToolsExtension()(createStore)(counter);
162+
window.store = window.__REDUX_DEVTOOLS_EXTENSION__()(createStore)(counter);
163163
expect(window.store).toBeA('object');
164164
});
165165
expect(message.type).toBe('INIT_INSTANCE');
@@ -171,7 +171,7 @@ describe('Redux enhancer', () => {
171171
const message = await listenMessage(() => {
172172
window.store = createStore(counter, compose(
173173
testEnhancer,
174-
window.devToolsExtension())
174+
window.__REDUX_DEVTOOLS_EXTENSION__())
175175
);
176176
expect(window.store).toBeA('object');
177177
});

Diff for: test/electron/fixture/renderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const store = createStore(
1717
}
1818
},
1919
initialState,
20-
window.devToolsExtension ? window.devToolsExtension() : noop => noop
20+
window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : noop => noop
2121
);
2222

2323
const el = document.getElementById('counter');

Diff for: test/perf/send.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function test(title, data, maxTime = 100) {
88
it('should send ' + title, async() => {
99
const start = new Date();
1010
await listenMessage(() => {
11-
window.devToolsExtension.send({ type: 'TEST_ACTION', data }, data);
11+
window.__REDUX_DEVTOOLS_EXTENSION__.send({ type: 'TEST_ACTION', data }, data);
1212
});
1313
const ms = new Date() - start;
1414
// console.log(ms);

0 commit comments

Comments
 (0)