Browse Source

realm mock object updates

pull/1/head
Tim Glasgow 2 years ago
parent
commit
7b9b048c64
  1. 25
      squarenotsquare/__mock__/mockRealmObject.js

25
squarenotsquare/__mock__/mockRealmObject.js

@ -6,16 +6,27 @@ export class MockRealm{
constructor(schemaVersion){
this.schemaVersion = schemaVersion;
this.SystemRepo = System.name;
this.ScoreRepo = Score.name;
this.UserRepo = User.name;
this[this.SystemRepo] = [];
this[this.ScoreRepo] = [];
this[this.UserRepo] = [];
this[System.name] = [];
this[Score.name] = [];
this[User.name] = [];
this.deletedKeys = [];
}
create(repoName, entity){
this[repoName].push(entity);
}
objects(repoName){
let objects = this[repoName];
objects.filtered = this.filtered ? this.filtered.bind(this, repoName) : () => objects;
return objects;
}
write(callback){
callback();
}
delete(key){
this.deletedKeys.push(key);
}
}
Loading…
Cancel
Save