Goodvidio Backend Software Engineer
Big Team
Many Projects
Many Test Suites
it('throws an error on wrong query', function (done) {
stub = sinon
.stub(analyticsService, '_queryAPI')
.returns(BPromise.reject(
new Error('Something went wrong')
));
analyticsService.queryAPI({})
.catch(Error, function (err) {
expect(err.message)
.to.equal('Something went wrong');
done();
});
});
it('Should handle recommended video filtering', function (done) {
var request = shopPagesService
.prepareRequest({'videos.recommended': 'VIDEOID'}, {});
expect(request.query)
.to.have.property('videos.recommended.video')
.and.to.equals('VIDEOID');
expect(request.query)
.to.not.have.property('videos.recommended');
done();
});
describe('Handle recommended video filtering', function (done) {
var request = {};
before(function (done) {
request = shopPagesService
.prepareRequest({'videos.recommended': 'VIDEOID'}, {});
});
it('Should contain recommended videos property', function (done) {
expect(request.query)
.to.not.have.property('videos.recommended');
done();
});
it('Should contain the ID', function (done) {
expect(request.query)
.to.have.property('videos.recommended.video')
.and.to.equals('VIDEOID');
done();
});
});
describe('Sorting', function () {
before(function (done) {
/*
* Create a couple of platforms
*/
});
it('Sorts results on name with default order', function (done) {
/*
* Test since you know the state of the DB
*/
});
after(function (done) {
/*
* Delete the previous created platforms
* so we leave the DB in the previous state
*/
});
});
Tests should always assert something.