jeudi 28 mai 2015

Test throwing an error using mocha

I have got a csv file containing records of students, their ID and marks. When parsing the csv, it should throw an error if a student has two different marks for one subject. I just want to test it, but when I am running my test, the test fails and throw the error which is correct, so the test should be passed but it fails.

it('Should have second score', function () {
        var pupil = _.findWhere(actual, {ID: '1'});
        var pSubject = _.findWhere(pupil.subjects, {name:'Mathematics'}); 
        assert.throws(assert.equal(500, pSubject.scores[1].score), Error);
    });

Aucun commentaire:

Enregistrer un commentaire