I use mocha, chai, and chai-as-promised. The test should fail, but it doesn't, I don't know what's wrong, any suggestions?
const { describe, it } = require('mocha')
const chai = require('chai')
const { expect } = require('chai')
const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
describe('test', () => {
it('must be rejected', async () => {
expect(Promise.resolve('success')).to.rejected
})
})
I tried to test a promise that should be rejected and the test should fail, but the test was successful

From the Chai as Promised docs
You can use
async / awaitor.then(() => {})to include multiple promises in a test.These four tests will fail:
Live example: https://stackblitz.com/edit/node-a7t3tx?file=index.js