diff --git a/squarenotsquare/__tests__/DB-test.js b/squarenotsquare/__tests__/DB-test.js index cdaa3b1..19e2b2e 100644 --- a/squarenotsquare/__tests__/DB-test.js +++ b/squarenotsquare/__tests__/DB-test.js @@ -1,4 +1,10 @@ -import { initDB } from "../src/realm/dbInit"; +import { initDB } from '../src/realm/dbInit'; +import { + getAllSystemValues, + createSystemValue, + deleteSystemValue, + getSystemValue + } from '../src/realm/dbAPI'; test('Realm DB inits', () => { return initDB('negTest', 'negTest') @@ -26,4 +32,36 @@ test('Realm DB returns null after exceptions', () => { .then( (dbRef) => { expect(dbRef).toEqual(null); }); +}); + +test('dbAPI calls system repo getAllSystemValues()', () => { + return initDB('isNull', 'isNull') + .then( () => { + let returned = getAllSystemValues(); + expect(returned).toEqual({}); + }); +}); + +test('dbAPI calls system repo createSystemValue()', () => { + return initDB('isNull', 'isNull') + .then( () => { + let returned = createSystemValue(); + expect(returned).toEqual(true); + }); +}); + +test('dbAPI calls system repo deleteSystemValue()', () => { + return initDB('isNull', 'isNull') + .then( () => { + let returned = deleteSystemValue(); + expect(returned).toEqual(true); + }); +}); + +test('dbAPI calls system repo getSystemValue()', () => { + return initDB('isNull', 'isNull') + .then( () => { + let returned = getSystemValue('notakey'); + expect(returned.id).toEqual(null); + }); }); \ No newline at end of file