Skip to content

Commit

Permalink
test: add some tests around deferred promise resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 committed Jun 7, 2021
1 parent 6f3a5fb commit 7753121
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions npm/webpack-preprocessor/test/unit/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ describe('webpack preprocessor', function () {
expect(preprocessor.__bundles()[this.file.filePath]).to.be.undefined

return this.run().then(() => {
// resolve prop should not exist, since promise should have been resolved.
expect(preprocessor.__bundles()[this.file.filePath].promise).not.to.have.property('resolve')
expect(preprocessor.__bundles()[this.file.filePath].promise).not.to.have.property('reject')
expect(preprocessor.__bundles()[this.file.filePath].deferreds).to.be.empty
expect(preprocessor.__bundles()[this.file.filePath].promise).to.be.instanceOf(Promise)
expect(webpack).to.be.called
})
})
Expand Down Expand Up @@ -337,7 +341,10 @@ describe('webpack preprocessor', function () {
expect(preprocessor.__bundles()[this.file.filePath]).to.be.undefined

return this.run().catch((err) => {
expect(preprocessor.__bundles()[this.file.filePath].promise).not.to.have.property('resolve')
expect(preprocessor.__bundles()[this.file.filePath].promise).not.to.have.property('reject')
expect(preprocessor.__bundles()[this.file.filePath].deferreds).to.be.empty
expect(preprocessor.__bundles()[this.file.filePath].promise).to.be.instanceOf(Promise)
expect(err.stack).to.equal(this.err.stack)
})
})
Expand Down

0 comments on commit 7753121

Please sign in to comment.