menu

Testing Library

Simple and complete DOM testing utilities that encourage good testing practices.

Channels
Team
Posts
Chat
Members
Info
down-caret

How to mock document.createRange(...).createContextualFragment?

Hey, asFragment uses document.createRange and createContextualFragment, if it's available. I'm running my tests with jest@24 and jsdom@14, so I need to mock document.createRange. …

thumbsup
0
message-simple
3

render not calling ngOnInit

#testing-library/angular Note: If someone has a way to create a repro using testing-library/angular I'm happy to do that, but I've played around in CodeSandbox without success. My issue is that, contrary to prior experience, and my own thinking, it appears that ngOnInit isn't…

thumbsup
0
message-simple
5

Testing filtering in virtual scroller selector

Hey Everyone. I'm new to testing, just started testing our env, and trying to show my bosses that it's worth my time. I'm trying to test our new selector component, and I want to test its filtering mechanism. I wanted to check how many selector-option data-ids there are, but…

thumbsup
0
message-simple
4

Correct type for renderWithRedux function

Could you help me with a problem I'm having with testing-library, redux and typescript? Do you know how I would type this function correctly?

thumbsup
0
message-simple
3

how to apply react testing library

I am applying to react testing library into the code base of the company, but, I not sure understand codebase 100%. Should help me some advice?

thumbsup
0
message-simple
1

FactoryBot like mocks for different varieties of global state?

So my react testing is limited, most of my testing experience has been backend unit testing. Our App uses MobX, and there are a couple instances of MobX stores(in the form of es6 class instances), UserStore and MasterStore, that contain a lot of access control logic. So when…

thumbsup
0
message-simple
1

Question about query methods when using act

How do you get the methods like getByText, etc.. when rendering using the act function? So for example: Some Context I'm using await act(..) because the component I am rendering is using the useEffect hook and updating some state prop within an async call.

thumbsup
0
message-simple
7

Invariant violation on using render from testing library

Hi all, I have recently started using the react testing library. Basically, was looking to test a container that renders several other containers. Using the render API resulting in an "Invariant Violation: Element type is invalid: expected a string (for built-in components) or a…

thumbsup
0
message-simple
16

Testing ag-grid with serverside row model type does not render and cell data.

I have a reactJS app built with ag-grid. Its row model type is serverside. I can render the grid with the browser without an issue. But when I use react-testing-library. I can not see and cell data. But if I change that to rowData={myData}, I can see all the rows. What is the…

thumbsup
0
message-simple
0

Not detecting a changed DOM in Vue.

UPDATE: The false positive was a result of a return statement stopping tests from running after that line. Now I'm hitting an issue with the DOM not changing before the final expect executes. As far as I can tell I'm using async/await like the documentation says to. Is there…

thumbsup
0
message-simple
16