jeudi 2 juin 2016

Why is this test failing? Array should equal []

enter image description here

My test, below the alerts var is an empty array [] however this throws an error.

it('FeedFactory alerts array is filled', function() {
    var alerts = FeedFactory.returnAlerts();
    console.log('alerts',alerts);
    expect(alerts).to.equal([]);
});

Here is the test log when I comment out the last expect(alerts).to.equal([]); line.

enter image description here

Code from my Factory

var alerts = [];

var feedFactory = {
    alerts       : alerts,
    getFeed      : getFeed,
    returnAlerts : returnAlerts,
    saveFilters  : saveFilters,
    getFilters   : getFilters
};

function returnAlerts() {
    return alerts;
}

Aucun commentaire:

Enregistrer un commentaire