Browse Source

db tests

pull/1/head
Tim Glasgow 2 years ago
parent
commit
c51d80ae36
  1. 40
      squarenotsquare/__tests__/DB-test.js

40
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);
});
});
Loading…
Cancel
Save