diff --git a/squarenotsquare/__mock__/mockRealmObject.js b/squarenotsquare/__mock__/mockRealmObject.js index a32e1cc..cebcc79 100644 --- a/squarenotsquare/__mock__/mockRealmObject.js +++ b/squarenotsquare/__mock__/mockRealmObject.js @@ -1,14 +1,14 @@ -import { Score } from "../src/realm/entities/Score"; -import { System } from "../src/realm/entities/System"; -import { User } from "../src/realm/entities/User"; +import { ScoreEntity } from "../src/realm/entities/Score"; +import { SystemEntity } from "../src/realm/entities/System"; +import { UserEntity } from "../src/realm/entities/User"; -export class MockRealm{ +export default class MockRealm{ - constructor(schemaVersion){ - this.schemaVersion = schemaVersion; - this[System.name] = []; - this[Score.name] = []; - this[User.name] = []; + constructor(params){ + this.schemaVersion = params.schemaVersion; + this[SystemEntity.name] = []; + this[ScoreEntity.name] = []; + this[UserEntity.name] = []; this.deletedKeys = []; } @@ -29,4 +29,19 @@ export class MockRealm{ delete(key){ this.deletedKeys.push(key); } + + static defaultPath = ''; + static schemaVersion(path, key){ + if (path === 'negTest') { + return -1; + } else if (path === 'breakDB') { + throw 'Existing DB is broken'; + } else { + return 0; + } + } + + close(){ + return null; + } } \ No newline at end of file