lundi 5 novembre 2018

Test timing out when 2 expect statements present

I have this in my coffeescript test:

# List 1st bucket to find an 1 object
.then -> 
  s3.listObjectsV2(
    Bucket: bucketName
  ).promise()

.then (data) ->
  expect(data.Contents.length).to.deep.equal(1)

# List 2nd bucket to find an empty list of objects
.then -> 
  s3.listObjectsV2(
    Bucket: bucketName2
  ).promise()

.then (data) ->
  expect(data.Contents.length).to.deep.equal(0)

This errors with Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves..

If I remove one of:

  .then (data) ->
    expect(data.Contents.length).to.deep.equal(1)

or:

  .then (data) ->
    expect(data.Contents.length).to.deep.equal(0)

The test passes. I've a feeling it's related to a promise not returning bir what is wrong that causes the test to fail when both expect statements are present?

Aucun commentaire:

Enregistrer un commentaire