es6-exercise icon indicating copy to clipboard operation
es6-exercise copied to clipboard

These questions are missing in src/07_promise.test.js, but in the solution.

Open wisteria-hill-technologies opened this issue 7 years ago • 0 comments

The below questions are missing in src/07_promise.test.js in master branch, but exist in the solution. Do we want to add them to the master branch? or remove them from the solution branch?

it('the `resolve` function can return a value, that is consumed by the `promise.then()` callback', (done) => {
      let promise = new Promise((resolve) => {
        resolve()
      })

      promise
        .then(value => {
          expect(value).toEqual(42)
          done()
        })
        .catch(() => done(new Error('The promise is expected to resolve with 42!')))
    })

also

it('is rejected if one rejects', (done) => {
      const promise = Promise.all([
        new Promise((resolve, reject) => reject(1))
      ])

      promise
        .then(() => {
          const err = new NotRejectedError()
          console.log(err)
          done()
        })
        .catch(() => done())
    })