|
@ -6,16 +6,27 @@ export class MockRealm{ |
|
|
|
|
|
|
|
|
constructor(schemaVersion){ |
|
|
constructor(schemaVersion){ |
|
|
this.schemaVersion = schemaVersion; |
|
|
this.schemaVersion = schemaVersion; |
|
|
this.SystemRepo = System.name; |
|
|
this[System.name] = []; |
|
|
this.ScoreRepo = Score.name; |
|
|
this[Score.name] = []; |
|
|
this.UserRepo = User.name; |
|
|
this[User.name] = []; |
|
|
|
|
|
this.deletedKeys = []; |
|
|
this[this.SystemRepo] = []; |
|
|
|
|
|
this[this.ScoreRepo] = []; |
|
|
|
|
|
this[this.UserRepo] = []; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
create(repoName, entity){ |
|
|
create(repoName, entity){ |
|
|
this[repoName].push(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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |