entria-fullstack icon indicating copy to clipboard operation
entria-fullstack copied to clipboard

Fix "should render success UserList" test

Open lucas-mdiniz opened this issue 4 years ago • 2 comments

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.

lucas-mdiniz avatar Oct 26 '20 22:10 lucas-mdiniz

Paste here the stack trace

daniloab avatar Oct 28 '20 12:10 daniloab

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: 
              &lt;User-mock-id-1&gt;
            </span>
            <span>
              User: 
              &lt;mock-value-for-field-"name"&gt;
            </span>
            <span>
              Email: 
              &lt;mock-value-for-field-"email"&gt;
            </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)

lucas-mdiniz avatar Oct 28 '20 15:10 lucas-mdiniz