describe('Repository', () => { it('should connect with a promise', () => { repository.connect({}).should.be.a.Promise() }) })
describe('#createNetwork', () => { it('should merge name correctly into opts', () => { const stub = sinon.stub(landerode, 'createNetwork') .usingPromise(Promise) .resolves(); return landerode.createNet('elthree', {}).then(() => { // for some reason should/expect doesn't work here... stub.calledWith({Name: 'elthree'}); stub.restore(); }); }); it('should throw an error if can\'t create network', () => { const stub = sinon.stub(landerode, 'createNetwork').rejects('Too Many Capes'); return landerode.createNet('hardtimes').should.be.rejectedWith('Too Many Capes') .then(() => { stub.restore(); }); }); });
it('should return an events instance with correct default options', () => { const events = new AsyncEvents(); events.should.be.instanceof(AsyncEvents); events.should.be.an('object').with.property('log'); events.should.have.property('_maxListeners', 64); events._listeners.should.be.an('array').and.be.empty; events.should.have.property('_eventsCount', 0); }); const log = sinon.spy(); const events = new AsyncEvents(log); events.should.have.property('log', log); }); }); .filter(event => event.priority === 5) .size(); priorityFiveEvents.should.equal(2); }); events.on('event', 6, after); events.emit('event').then(() => { before.should.be.calledBefore(middle); middle.should.be.calledBefore(after); after.should.be.calledAfter(middle); }); }); it('should return a promise', () => {
return shell.sh(['slip', 'sliding', 'away']) .then(result => { result.should.equal('EXEC: slip sliding away'); }) .then(_shell.exec.restore()) .should.be.fulfilled; }); return shell.sh(['tupelo', 'honey', 'baby'], opts) .then(result => { result.should.equal('SPAWN: tupelo honey baby'); }) .should.be.fulfilled; }); child.spawn.restore(); const shell = new Shell(); sinon.stub(child, 'spawn').callsFake(fakeSpawn); return shell.sh(['set', 'us', 'up', 'the', 'bomb'], {mode: 'attach'}).should.be.rejected .then(child.spawn.restore()); }); const shell = new Shell(); sinon.stub(child, 'spawn').callsFake(fakeSpawn); return shell.sh(['van', 'the', 'man'], {detached: true}).should.be.fulfilled .then(child.spawn.restore()); }); process.lando = 'browser';
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"); });
}); return testApp.request(mockRequest).should.be.rejectedWith("whoops"); });
.should.eventually.be.fulfilled .and.not.have.deep.property("response.outputSpeech.type"); });
it("should return a list of events for a popular coordinate (Brooklyn, NY)", function (done) { // Set timeout this.timeout(10000); var es = new EventSearch(); es.search({ "lat": 40.710803, "lng": -73.964040, "distance": 100, "accessToken": accessToken }).should.be.fulfilled.and.notify(done); });
it('rejects temp_unavail statuses', function () { scope.reply(200, {'status': 'temp_unavail', 'message': 'Service has gone away'}, { 'Content-Type': 'application/json' }); return http.request({path: 'test'}).should.be.rejected .then( err => err.should.contain({'type': NeverBounce.errors.GeneralError}) ) });
it("should return an error if no Access Token is present", function (done) { var es = new EventSearch(); es.search({ "lat": 40.710803, "lng": -73.964040, "distance": 100 }).should.be.rejectedWith({ "message": "Please specify the lat and lng parameters!", "code": 1 }).and.notify(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) }) })
it("should work applying the 'venueDistance' sort parameter", function (done) { // Set timeout this.timeout(10000); var es = new EventSearch(); es.search({ "lat": 40.710803, "lng": -73.964040, "distance": 100, "accessToken": accessToken, "sort": "venueDistance" }).should.be.fulfilled.and.notify(done); });
it("should return an error if a partial coordinate is used", function (done) { var es = new EventSearch(); es.search({ "lat": 40.710803, "accessToken": accessToken }).should.be.rejectedWith({ "message": "Please specify an Access Token, either as environment variable or as accessToken parameter!", "code": 2 }).and.notify(done); });