samedi 2 mai 2015

does it make sense to test mongoose models?

I'm new to testing in general and although i see some projects like meanjs or ghost testing their models, some of it doesn't make much sense to me.

For instance, I've seen some people do something like this:

it( 'should create a new group', function( done ) {
      utils.fixtures.createGroup()
        .then( function( group ){
          group.should.exist;
          done();
        }).catch( function( err ){
          done(err);
        });
    });

Which looks to me like they are testing mongoose instead of testing their own code. If the model contains custom validation methods, etc, it makes perfect sense to test that.

So my question is if it makes any sense to test anything related to the model unless it's a schema method/hook ?

Aucun commentaire:

Enregistrer un commentaire