0
TruffleContract = artifacts.require("TruffleContract");

contract("TruffleContract", function() {
  it("should assert true", async function(done) {
    await TruffleContract.deployed();
    assert.isTrue(true);
    done();
      });
});

The above piece of code is giving me the following errors

1) Contract: TruffleContract
       should assert true:
     Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both.
      at Context.<anonymous> (test\truffle_contract.js:7:5)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

There is an issue in the function made.

Mikasa
  • 33
  • 6
  • Does this answer your question? [Why am I getting "Error: Resolution method is overspecified"?](https://stackoverflow.com/questions/41761683/why-am-i-getting-error-resolution-method-is-overspecified) – ggorlen Apr 12 '20 at 07:00
  • If your function is `async`, then it returns a promise. But you also use the `done` callback, so the test runner has no idea which resolution method to pay attention to (should it `await` your promise or wait until `done` was called?). Pick one or the other (probably get rid of `done` since you'd have to call it from a `then` callback which is sort of ugly). – ggorlen Apr 12 '20 at 07:01
  • @ggorlen removing await worked for me. Removing done made the code run in an infinite loop. – Mikasa Apr 12 '20 at 12:05

1 Answers1

0

dropping of await worked. Both await and done() made confusion in the program so await should be dropped

Mikasa
  • 33
  • 6