EatTheBlocks Forum

DEX test(withdraw) error?

Hi all, when trying to test the witdraw functions i get two failing tests…

3 passing (10s)
** 2 failing**

** 1) Contract: DEX**
** should withdraw tokens:**
** AssertionError: Unspecified AssertionError**
** at Context. (/Users/guestwprivelage/decex/test/DEX.js:101:2)**
** at runMicrotasks ()**
** at processTicksAndRejections (internal/process/task_queues.js:97:5)**

** 2) Contract: DEX**
** should NOT withdraw tokens if the balance is too low:**

** Wrong kind of exception received**
** + expected - actual**

** -balance too low – Reason given: balance too low.**
** +the balance is too low**


** at expectException (/Users/guestwprivelage/node_modules/@openzeppelin/test-helpers/src/expectRevert.js:20:30)**
** at runMicrotasks ()**
** at processTicksAndRejections (internal/process/task_queues.js:97:5)**

Looks like there is a typo either in your test or in the revert message in the smart contract. The reason of the revert in your test must match exactly with the reason of the revert in your smart contract.

1 Like

I too had this error, basically the error string written in Smart contract should exactly match to what used in the testing file.

1 Like

Thank you and yes that solved it! I need to make sure to keep track of both of the test file and contract file string errors.

1 Like