it("should succeed and return empty object ", function() { return testApp.request(mockHelper.load("audio_player_events/playback_finished.json")) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); it("should succeed and return empty object ", function() { return testApp.request(mockHelper.load("audio_player_events/playback_failed.json")) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); it("should succeed and return empty object ", function() { return testApp.request(mockHelper.load("audio_player_events/playback_nearly_finished.json")) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); it("should succeed and return empty object ", function() { return testApp.request(mockHelper.load("audio_player_events/playback_started.json")) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); }); it("should succeed and return empty object ", function() { return testApp.request(mockHelper.load("audio_player_events/playback_stopped.json")) .should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); });
.should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); });
it('should parse "99.9" to float', (done) => { const rules = { amount: { type: 'float' } }; const params = { amount: '99.9' }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('amount', 99.9); done(); }); });
describe('Airtable.create', function () { it('Airtable.create', function (done) { const airtable = new Airtable({ apiKey, base, table }) const promise = airtable.create({ fields: {Name: 'Tom'} }) log(promise) promise.should.eventually.be.fulfilled.notify(done) }) })
describe('rule: default', () => { it('should return an object with a default value', (done) => { const rules = { per_page: { type: 'integer', default: 20 } }; expect(whitelister(rules, {})).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('per_page', 20); done(); }); }); });
it("should resume a workflow", async () => { // Arrange const workflowClass = class TestWorkflow extends AbstractWorkflow {}; const customId = "45745c60"; // Act const builder = new Builder(workflowClass); const result = builder.whereId(customId).resume(); // Assert await expect(result).to.eventually.be.fulfilled(); expect(resumeWorkflowFake).to.have.been.calledOnceWithExactly( workflowClass, customId, ); });
it("Should load a user with the correct password", (done) => { expect(userManager.auth("john", "123456")) .to.eventually.be.fulfilled .notify(done) })
it('should accept a valid array of numbers', (done) => { const rules = { digits: 'array' }; const params = { digits: [1, 2, 3] }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object') .that.has.property('digits') .that.is.an('array') .that.has.members([1, 2, 3]); done(); }); });
it('should accept value of "bob+spam@email.com"', (done) => { const rules = { email: 'email' }; const params = { email: 'bob+spam@email.com' }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.have.property('email', 'bob+spam@email.com'); done(); }); });
it("should kill a workflow", async () => { // Arrange const workflowClass = class TestWorkflow extends AbstractWorkflow {}; const customId = "45745c60"; // Act const builder = new Builder(workflowClass); const result = builder.whereId(customId).kill(); // Assert await expect(result).to.eventually.be.fulfilled(); expect(killWorkflowFake).to.have.been.calledOnceWithExactly( workflowClass, customId, ); });
it('should accept 88.8', (done) => { const rules = { amount: { type: 'float' } }; const params = { amount: 88.8 }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('amount', 88.8); done(); }); });
it('should accept value of "bob@email.com"', (done) => { const rules = { email: 'email' }; const params = { email: 'bob@email.com' }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.have.property('email', 'bob@email.com'); done(); }); });
it('should accept 9999', (done) => { const rules = { user_id: { type: 'integer' } }; const params = { user_id: 9999 }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('user_id', 9999); done(); }); });
it('should parse "100" to integer', (done) => { const rules = { user_id: { type: 'integer' } }; const params = { user_id: '100' }; expect(whitelister(rules, params)).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('user_id', 100); done(); }); });
describe('rule: allowNull', () => { const rules = { name: { type: 'string', allowNull: true } }; it('should return an object with property: null', (done) => { expect(whitelister(rules, { name: null })).to.eventually.be.fulfilled .then((response) => { expect(response).to.be.an('object').that.has.property('name', null); done(); }); }); });