Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* (c) William Belle, 2019. | ||
* See the LICENSE file for more details. | ||
*/ | ||
|
||
const should = require('chai').should(); | ||
const rewire = require('rewire'); | ||
|
||
const epflMenuApi = require('../src/index.js'); | ||
|
||
describe('epfl-menu-api findResto', function () { | ||
this.timeout(10000); | ||
|
||
it('should contains at least 5 restos', function () { | ||
return epflMenuApi.findResto().then((restos) => { | ||
var enoughRestos = Object.keys(restos).length > 4; | ||
enoughRestos.should.equal(true); | ||
}); | ||
}); | ||
|
||
it('should fail with a wrong service url', (done) => { | ||
let epflMenuApiMock = rewire('../src/index.js'); | ||
epflMenuApiMock.__set__('RESTOS_URL', 'foobar'); | ||
let result = epflMenuApiMock.findResto(); | ||
result.then((response) => { | ||
should.fail(); | ||
done(); | ||
}).catch((reason) => done()); | ||
}); | ||
}); |