           ->
             # expecting credential to be created
             JCredential.create client, options, (err, credential_) ->
-              expect(err?.message).to.not.exist
+              expect(err).to.not.exist
               credential = credential_
               expect(credential.provider).to.be.equal provider
               expect(credential.title).to.be.equal title


      withConvertedUserAndCredential ({ client, credential }) ->
        JCredential.one$ client, credential.identifier, (err, credential_) ->
          expect(err?.message).to.not.exist
          expect(credential_).to.exist
          expect(credential_._id).to.be.deep.equal credential._id
          done()


      withConvertedUserAndCredential ({ client, credential }) ->
        JCredential.fetchByIdentifier client, credential.identifier, (err, credential_) ->
          expect(err).to.not.exist
          expect(credential_).to.exist
          expect(credential_._id).to.be.deep.equal credential._id
          done()
