I can make the tokenResponse look like that when doing res.body, but that would not work for the real api the site uses.
However - it seems as something is still wrong with this as I have a p tag that should looks like:
<p>I confirm I am {this.state.tokenResponse.first_name} {this.state.tokenResponse.last_name}</p>
So when the page loads with the real api it looks like:
<p>I confirm I am Test Bob</p>
However, when I force res.body and debug the enzyme instance, I get:
<p>
I confirm I am
</p>
Can anyone see if I'm doing something obvously wrong? I searched through the docs and can't find anything. Been battling my head at this test case for upwards of 3 hours, just trying to mock a response and make sure the view loads the I confirm I am Test Bob...
I have the following code in a component of mine:
This component works, and res is an object of values, like
first_name, last_name
etc.When running the test using the following
mockResponseOnce
:When I console log the state of the component, it seems the tokenResponse is an instance of a Response object:
Where my component expects something similar to:
I can make the
tokenResponse
look like that when doingres.body
, but that would not work for the real api the site uses.However - it seems as something is still wrong with this as I have a p tag that should looks like:
So when the page loads with the real api it looks like:
<p>I confirm I am Test Bob</p>
However, when I force
res.body
and debug the enzyme instance, I get:Can anyone see if I'm doing something obvously wrong? I searched through the docs and can't find anything. Been battling my head at this test case for upwards of 3 hours, just trying to mock a response and make sure the view loads the
I confirm I am Test Bob
...