Skip to content

Commit bf33f6d

Browse files
Venkataramanan VenkateswaranVenkataramanan Venkateswaran
authored andcommitted
Venkataramanan fix: remove hardcoded password values from tests
1 parent e79841a commit bf33f6d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import { Provider } from 'react-redux';
3+
import { BrowserRouter as Router } from 'react-router-dom';
4+
import thunk from 'redux-thunk';
5+
import { configureStore } from 'redux-mock-store';
6+
import { render } from '@testing-library/react';
7+
8+
const mockStore = configureStore([thunk]);
9+
10+
export const makeStore = (overrides = {}) =>
11+
mockStore({
12+
auth: {
13+
isAuthenticated: true,
14+
user: {
15+
permissions: { frontPermissions: [], backPermissions: [] },
16+
role: 'Owner',
17+
},
18+
permissions: { frontPermissions: [], backPermissions: [] },
19+
},
20+
...overrides,
21+
});
22+
23+
export const renderWithStoreRouter = (ui, { store } = {}) => {
24+
const testStore = store || makeStore();
25+
return {
26+
store: testStore,
27+
...render(
28+
<Provider store={testStore}>
29+
<Router>{ui}</Router>
30+
</Provider>,
31+
),
32+
};
33+
};

0 commit comments

Comments
 (0)