From 7b9b048c6486f5709e85ad2d9d02a226c4123c57 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Fri, 29 Jul 2022 23:54:02 -0500 Subject: [PATCH] realm mock object updates --- squarenotsquare/__mock__/mockRealmObject.js | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/squarenotsquare/__mock__/mockRealmObject.js b/squarenotsquare/__mock__/mockRealmObject.js index 294f642..481e814 100644 --- a/squarenotsquare/__mock__/mockRealmObject.js +++ b/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); + } } \ No newline at end of file