entria-fullstack
entria-fullstack copied to clipboard
Fix "should render success UserList" test
As mentioned at #140, one test is not passing.
The test is:
should render success UserList
It seems to be some problem on mocking the payload ( MockPayloadGenerator
) but I'm not sure yet, it needs more debugging.
Paste here the stack trace
Here is the stack trace:
● <UserList /> › should render success UserList
TestingLibraryElementError: Unable to find an element with the text: ID: Q2xpZW50OjE=. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
<body>
<div>
<div>
<a
class="UserList__Card-sc-1uc7hyr-0 cHjsxG"
>
<span>
ID:
<User-mock-id-1>
</span>
<span>
User:
<mock-value-for-field-"name">
</span>
<span>
Email:
<mock-value-for-field-"email">
</span>
</a>
</div>
</div>
</body>
78 | });
79 |
> 80 | expect(getByText('ID: Q2xpZW50OjE=')).toBeTruthy();
| ^
81 | expect(getByText('User: Adhis Yudha')).toBeTruthy();
82 | expect(getByText('Email: [email protected]')).toBeTruthy();
83 |
at Object.getElementError (../../node_modules/@testing-library/dom/dist/config.js:37:19)
at args (../../node_modules/@testing-library/dom/dist/query-helpers.js:90:38)
at args (../../node_modules/@testing-library/dom/dist/query-helpers.js:62:17)
at getByText (../../node_modules/@testing-library/dom/dist/query-helpers.js:106:19)
at _callee2$ (src/__tests__/UserList.spec.tsx:80:12)
at tryCatch (../../node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (../../node_modules/regenerator-runtime/runtime.js:293:22)
at Generator.next (../../node_modules/regenerator-runtime/runtime.js:118:21)
at asyncGeneratorStep (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
at ../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
at Object.<anonymous> (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)