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

        selector = { _id : credential._id }
        options  = {}
        JCredential.some$ client, selector, options, (err, credentials) ->
          expect(err?.message).to.not.exist
          expect(credentials).to.be.an 'array'
          expect(credentials).to.have.length 1
          done()

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