Commit b0b4daba authored by Yadd's avatar Yadd
Browse files

Clean tests (#1570)

parent df1036d1
Pipeline #12352 failed with stage
in 51 minutes and 25 seconds
......@@ -54,7 +54,7 @@ store.dispatch({
});
describe('Nav component with one route', () => {
const app = (
const App = (
<div className="App">
<Provider store={store}>
<ConnectedRouter history={history}>
......@@ -69,7 +69,7 @@ describe('Nav component with one route', () => {
</Provider>
</div>);
it('Should renders menu', () => {
const { getByText } = render(app);
const { getByText } = render(App);
expect(getByText('Configuration')).toBeInTheDocument();
expect(getByText('Sessions')).toBeInTheDocument();
expect(getByText('Notifications')).toBeInTheDocument();
......
......@@ -9,26 +9,28 @@ import App from '../App';
// src/lib/__mocks__/lib/llngFetch.js in all "import" commands
jest.mock('../lib/llngFetch')
let appTest;
beforeEach(() => {
appTest = render(<App />);
});
describe('Default app', () => {
// src/lib/__mocks__/lib/llngFetch.js replace {conf:"Configuration"}
// by {conf:"mock Configuration"}
it('Should download language', async () => {
const { findByText } = render(<App />);
expect(await findByText('en Configuration')).toBeInTheDocument();
expect(await appTest.findByText('en Configuration')).toBeInTheDocument();
});
it('should display portal links', async () => {
const { getByText } = render(<App />);
expect(getByText('Back to portal')).toBeInTheDocument();
expect(getByText('Logout')).toBeInTheDocument();
it('should display portal links', () => {
expect(appTest.getByText('Back to portal')).toBeInTheDocument();
expect(appTest.getByText('Logout')).toBeInTheDocument();
})
it('should be able to change language to fr', async () => {
const { getByAltText, findByText } = render(<App />);
const fr = getByAltText('fr');
const fr = appTest.getByAltText('fr');
expect(fr).toBeInTheDocument();
fr.click();
expect(await findByText('fr Configuration')).toBeInTheDocument();
expect(await appTest.findByText('fr Configuration')).toBeInTheDocument();
})
})
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment