mardi 17 juillet 2018

Comparing an array object to string using mocha && chai.

I am using mocha and chai for the first time and have no idea what is going on? im trying to say that my shuffle method has moved the array objects around and the first array object no longer - "sam1" IE -

describe('Shuffle', function(){

it('Shuffle should randomly move array items by their index', function(){
    let group = ["sam1","sam2","sam3","sam4","sam5","sam6","sam7","sam8","sam9"];
    let result = shuffle(group);
    assert.equal(result, group[0] != "sam1");
  });
});


this is the error -

AssertionError: expected [ Array(9) ] to equal true

how do i compare the two to make it true? or is there a better way to show the array has been shuffled?

Aucun commentaire:

Enregistrer un commentaire