it("Should not load a user with a wrong password", (done) => { expect(userManager.auth("john", "wrongpassword")) .to.eventually.be.rejected .notify(done) })
describe('-> smapiClient.tokens.refresh() with bad refreshToken', function() { const tokensRefreshWillThrow = () => smapiClient.tokens.refresh({ refreshToken: 'bad', clientId: 'bad', clientSecret: 'bad' }); var subject; beforeEach(function() { subject = tokensRefreshWillThrow(); }); it('eventually be rejected', function() { return expect(subject).to.eventually.be.rejected; }); });
describe('#events', () => { it('listen to output event', function(done) { this.timeout(0); ps.on('output', data => { ps.removeAllListeners(); expect(data).to.equal('test'); done(); }); ps.addCommand(new PSCommand(COMMAND).addArgument('test').addParameter({nonewline: undefined})) .then(() => ps.invoke()); }); it('listen to err event', function(done) { this.timeout(0); ps.on('err', error => { ps.removeAllListeners(); expect(error).to.be.an.instanceof(PS_CMD_FAIL_ERROR); done(); }); ps.addCommand('throw "error"') .then(() => expect(ps.invoke()).to.eventually.be.rejected); }); });
const result = purchaseService.purchase({ name: 'pikachu', quantity: 1 }, cards.invalid) return expect(result).to.eventually.rejected }) })
it("Should fail to create a user with an existing nickname", (done) => { expect( userManager.create("john", "123456", userManager.Groups.ADMINS) ) .to.eventually.be.rejected .notify(done); })