samedi 24 juin 2017

Testing promise with ava

I try to test this class

class Scraper {
  async run() {
    return await nightmare
      .goto(this.url)
      .wait('...')
      .evaluate(()=>{...})
      .end
  }
}

And my test looks like this:

test('Scraper test', t => {
  new Scraper().run().then(() => {
    t.is('test', 'test')
  })
})

Test fails:

Test finished without running any assertions

Aucun commentaire:

Enregistrer un commentaire