Sigma-Labs-XYZ / Explain-AI

An AI-powered source of all human knowledge
https://explainai.me/
1 stars 1 forks source link

Tests failing #24

Open Ademsk1 opened 1 year ago

Ademsk1 commented 1 year ago

After pulling from main it seems that some tests are failing. After going in deeper, it appears that BrowserRouter is used on index.js:

index.js :
    <BrowserRouter>
      <App />
    </BrowserRouter>

And therefore, in the testing when we use render(<App/>) the testing does not know that it is wrapped inside a Browser Router. To fix this first issue we can replace the render with

import { BrowserRouter } from "react-router-dom";
render(<App /> ,{wrapper: BrowserRouter});

After adding only this (to my memory) AppRouter.test.js passes. It also appears that the test in Integration.test.jsis now not necessary; as we render the topic in the topics page, and not on the homepage.

For TopicPage.test.js I still receive the following errors for both tests


    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 0
DomVinyard commented 1 year ago

that's really well diagnosed, would you be able to raise a PR with your fix @Ademsk1

Ademsk1 commented 1 year ago

@DomVinyard Will do!