jeudi 18 août 2016

How to test a _.cloneDeep() in angularjs with mocha-chai?

I'm new with js and angularjs, and I'm doing the unit testing of the application. I suppose it's maybe a dumb question, but I'm testing with mocha-chai, and I'm having a problem testing a _.cloneDeep(), it's something like this:

scope.example1 = _.cloneDeep(example2);

Being example2 something like this:

example2: {
  id: 'example2',
  workers: [
    {
      name: 'James'
      id: 'james'
    },
    {
      name: 'Elliot'
      id: 'elliot'
    }
  ],
  active: true
}

How can I check that _cloneDeep() is correctly done? I have tried with chai stuff like expect().to.equal() or expect().to.eql() but it's not working.

Aucun commentaire:

Enregistrer un commentaire