Merge pull request #95 from angfal/fix/remote_exists

Add tests to check Model.exists() working
This commit is contained in:
Miroslav Bajtoš 2019-08-23 10:27:56 +02:00 committed by GitHub
commit 4efca1f052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -200,6 +200,29 @@ describe('Remote model tests', function() {
});
});
describe('Model.exists(id, callback)', function() {
it('should return true when the model with the given id exists',
function(done) {
ServerModel.create({first: 'max'}, function(err, user) {
if (err) return done(err);
ClientModel.exists(user.id, function(err, exist) {
if (err) return done(err);
assert.equal(exist, true);
done();
});
});
});
it('should return false when there is no model with the given id',
function(done) {
ClientModel.exists('user-id-does-not-exist', function(err, exist) {
if (err) return done(err);
assert.equal(exist, false);
done();
});
});
});
describe('Model.findById(id, callback)', function() {
it('should return null when an instance does not exist',
function(done) {