pancakeswap / pancake-frontend

:pancakes: Pancake main features (farms, pools, IFO, lottery, profiles)
https://pancakeswap.finance
GNU General Public License v3.0
2.69k stars 3.54k forks source link

[BUG] Unitary tests #4975

Closed 0xBRL closed 2 years ago

0xBRL commented 2 years ago

Is there an existing issue for this?

Product

Other

Current Behavior

Some unit tests are failing on the develop branch:

Running the unit tests:

$ yarn test
Test Suites: 2 failed, 43 passed, 45 total
Tests:       15 failed, 2 todo, 2715 passed, 2732 total
Snapshots:   0 total
Time:        4.87 s, estimated 5 s
Ran all test suites.

πŸ”Ž More info: test.log

Expected Behavior

All unit tests are expected to pass:

$ yarn test
Test Suites: 0 failed, 45 passed, 45 total
Tests:       0 failed, 2 todo, 2730 passed, 2732 total
Snapshots:   0 total
Time:        4.87 s, estimated 5 s
Ran all test suites.

Steps To Reproduce

  1. Clone the pancake-frontend project
  2. Install dependencies
  3. Run the tests locally
$ git clone https://github.com/pancakeswap/pancake-frontend.git
$ yarn
$ yarn test

Environment

- Device: MacBook Pro (M1)
- OS: macOS Monterey 12.6
- Browser: N/A
- Wallet: N/A
- Node: v16.17.1

Anything else?

No response

0xBRL commented 2 years ago

Heey @chef-jojo, I was trying to run some local tests and I find these errors. However these errors don't happen in Unit tests (Jest) (16) job in the GitHub, let me know if these tests need to be fixed πŸ€” (I found the issue, it's in the default language setting and expected values of tests. I think we can fix this)

I can work on it πŸ˜€

0xjojoex commented 2 years ago

yeah i think it's something related to toLocaleString. We should explicit setting the locale setting on jest test env