|
|
@ -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') |
|
|
@ -27,3 +33,35 @@ test('Realm DB returns null after exceptions', () => { |
|
|
|
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); |
|
|
|
}); |
|
|
|
}); |