Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

writing tests in javascript docs page example #1 is incorrect #686

Open
blockracers opened this issue Jun 14, 2020 · 2 comments
Open

writing tests in javascript docs page example #1 is incorrect #686

blockracers opened this issue Jun 14, 2020 · 2 comments
Assignees

Comments

@blockracers
Copy link

https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript

The first examples should use done or return the promise,
otherwise they it will pass incorrectly eg.

it('This will pass but should not', () => {
  Instance.deployed()
     .then(instance => {
          // won't get here
         assert();
      })
});

Should be:

it('This will pass but should not',  done => {
  Instance.deployed()
     .then(instance => {
        assert();
         done();
      })
});

or

it('This will pass but should not',  () => {
  return Instance.deployed()
     .then(instance => {
        assert();
         done();
      })
});
@OnlyOneJMJQ
Copy link
Contributor

Hi @blockracers! Thanks for pointing this out and apologies for late response! You're 100% correct, would you be willing to open a PR with these changes? Thanks again!

@OnlyOneJMJQ
Copy link
Contributor

Hey @blockracers, we're going to convert our tests to use async/await, so that will supersede this entirely. See issue #772. Keeping this open for now until that's addressed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants