Test container with multiple components translated
See original GitHub issueI am trying to test a container that has multiple components inside. When I mount the container all the nested containers will be mounted but I have an error:
TypeError: Cannot read property 'getFixedT' of undefined
Some of my components are exporting with the translation decorator:
export const TextAreaCounterComponent = TextAreaCounter;
export default translate(['defaultNamespace'])(TextAreaCounterComponent);
How can I test this containers?
const mockT = () => 'Hello';
const middlewares = [];
const mockStore = configureStore(middlewares);
const initialState = {
login: {
loggedIn: true,
},
app: {
isLoading: false,
popupIsOpen: false,
tabSelected: 0
}
};
const store = mockStore(initialState);
const wrapper = mount(
<Provider store={store}>
<Partner t={mockT} />
</Provider>
);
it.only('should mount partner page container', () => {
expect(wrapper.find('.wrap').length).toBe(1);
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Testing Angular container components
Container components translate component -specific events to application state commands — or actions to put it in Redux/NgRx Store terms.
Read more >How to use container components without sacrificing testability
Use few, high-level container components, which render presentational components. The reason for this is because presentational components are more reusable ( ...
Read more >How to Perform Integration Testing using JUnit 5 and ...
These Docker containers are lightweight, and once the tests are finished the ... various other components like Kafka, SOLR, Redis, and more.
Read more >NG0300: Multiple components match with the same tagname
If you're having trouble finding multiple components with this selector tag name, check for components from imported component libraries, such as Angular ...
Read more >Common mistakes with React Testing Library
Not using Testing Library ESLint plugins. Importance: medium. If you'd like to avoid several of these common mistakes, then the official ESLint ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works
how do you import i18next? seems to be an issue related to import (using typescript?)