return response.response.directives; }); return expect(subject).to.eventually.be.an("array"); });
describe('#addArgument()', () => { const ARGUMENT = 'PSCommand'; it('should add argument to the Shell', () => { const test = ps.addCommand(COMMAND) .then(() => ps.addArgument(ARGUMENT)); expect(test).to.eventually.be.an('array') .that.have.nested.property('[0].command', `${COMMAND} ${ARGUMENT}`); }); it('should fail adding argument to the Shell', () => { expect(ps.addArgument(ARGUMENT)).be.eventually.rejectedWith(PS_ARG_MISS_ERROR); }); });
describe('PaymentService', function () { describe('should buy a product with success', function () { const paymentService = new PaymentService(pagarmeHelper) const productMetadata = { product: 'pokemon', name: 'pikachu', quantity: 2 } return expect(paymentService.charge(cards.valid, 1245, productMetadata)) .to.eventually.be.an('object') }) })
describe("the challenges list", function() { it("has all challenges if no arguments are passed", () => { return expect(challenge.fetch()).to.eventually.be.an("array").that.is .not.empty; }); it("has only a subset of challenges if keys are passed", function() { return challenge.fetch(["hello-world"]).then(challenges => { expect(challenges).to.be.an("array").that.is.not.empty; expect(challenges.length).to.equal(1); }); }); });
describe('#addCommand()', () => { it('should add command to the Shell', () => { const psCommand = new PSCommand(COMMAND); expect(ps.addCommand(COMMAND)).to.eventually.be.an('array') .that.include(psCommand); expect(ps.addCommand(psCommand)).to.eventually.be.an('array') .that.have.lengthOf(2); }); it('should fail adding command to the Shell', () => { expect(ps.addCommand('')).be.eventually.rejectedWith(PS_ARG_MISS_ERROR); expect(ps.addCommand({})).be.eventually.rejectedWith(PS_ARG_TYPE_ERROR); }); });
describe('Output', function() { it('Should be resolved with the same passed context', function() { return expect(runResult).to.eventually.equal(context).deep.equal(sample.hints.context); }); it('Should provide a default context if no context is passed', function() { return expect(runWithoutContextResult).to.eventually.be.an('object'); }); it('Should return a promise', function() { expect(runResult).to.be.a('promise'); expect(runWithoutContextResult).to.be.a('promise'); }); });
return Promise.all([ expect(promisedOfficialDocs).to.eventually.be.fulfilled, expect(promisedOfficialDocs).to.eventually.be.an('object') ]); }); return Promise.all([ expect(this.pOfficialEndpoints).to.eventually.be.fulfilled, expect(this.pOfficialEndpoints).to.eventually.be.an('array'), expect(this.pOfficialEndpoints).to.eventually.all.have.keys(OFFICIAL_DOC_PARAMS) ]);
describe('#addParameter/s()', () => { const PARAMETER1 = {ForegroundColor: 'red'}; const PARAMETER2 = {name: 'BackgroundColor', value: 'white'}; it('should add parameter to the Shell', () => { const test = ps.addCommand(COMMAND) .then(() => ps.addParameter(PARAMETER1)) .then(() => ps.addParameter(PARAMETER2)); expect(test).to.eventually.be.an('array') .that.have.nested.property( '[0].command', `${COMMAND} -ForegroundColor red -BackgroundColor white` ); }); it('should add parameters to the Shell', () => { const test = ps.addCommand(COMMAND) .then(() => ps.addParameters([PARAMETER1, PARAMETER2])) expect(test).to.eventually.be.an('array') .that.have.nested.property( '[0].command', `${COMMAND} -ForegroundColor red -BackgroundColor white` ); }); it('should fail adding parameter to the Shell', () => { expect(ps.addParameter(PARAMETER1)).be.eventually.rejectedWith(PS_ARG_MISS_ERROR); expect(ps.addParameter(PARAMETER2)).be.eventually.rejectedWith(PS_ARG_MISS_ERROR); }); });
.and.be.an.instanceOf(TrackingError) .and.have.property('type', 'service_error') })