Skip to content

Instantly share code, notes, and snippets.

@danilat
Last active September 14, 2017 12:35
Show Gist options
  • Save danilat/31828dd41439763d5741a73285f13cbe to your computer and use it in GitHub Desktop.
Save danilat/31828dd41439763d5741a73285f13cbe to your computer and use it in GitHub Desktop.
beforeEach(()=> {
httpClient = new mosica.HttpClient();
matcher = new mosica.Matcher();
gigService = new mosica.GigService(httpClient, matcher);
httpClientStub = sinon.stub(httpClient, 'get').returns({
then: function(resp){
return resp({body: {response: someGigsByDay}});
}
});
});
//...
it('gets the gigs', () => {
return gigService.retrieveNextGigs().then((gigsByDay) => {
let gigs = gigsByDay[0].gigs;
expect(gigs.length).to.be.equal(2);
expect(gigs[0].title).to.be.equal('dead bronco');
expect(gigs[1].title).to.be.equal('celtas cortos');
});
});
//...
it('gets an existent gig', () => {
return gigService.retrieveAGig(1).then((gig) => {
expect(gig.title).to.be.equal('dead bronco');
});
});
//...
it('find the gigs normalizing accents', () => {
return gigService.searchGigs('lopez').then((gigs) => {
expect(gigs.length).to.be.equal(1);
expect(gigs[0].title).to.be.equal('dead bronco');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment