From 35421e2aae9719dc666bd6526f0b7ed012e61ed9 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Sat, 30 Jul 2022 14:42:49 -0500 Subject: [PATCH] db setup tests --- squarenotsquare/__tests__/DB-Setup-test.js | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/squarenotsquare/__tests__/DB-Setup-test.js b/squarenotsquare/__tests__/DB-Setup-test.js index ca6c85a..cdaa3b1 100644 --- a/squarenotsquare/__tests__/DB-Setup-test.js +++ b/squarenotsquare/__tests__/DB-Setup-test.js @@ -1,7 +1,29 @@ import { initDB } from "../src/realm/dbInit"; -test('Realm DB inits', async () => { - let realmDB = await initDB(); +test('Realm DB inits', () => { + return initDB('negTest', 'negTest') + .then( (dbRef) => { + expect(dbRef).toEqual(expect.anything()); + }); +}); - expect +test('Realm DB inits with no existing key', () => { + return initDB('isNull', 'isNull') + .then( (dbRef) => { + expect(dbRef).toEqual(expect.anything()); + }); +}); + +test('Realm DB inits with existing DB', () => { + return initDB() + .then( (dbRef) => { + expect(dbRef).toEqual(expect.anything()); + }); +}); + +test('Realm DB returns null after exceptions', () => { + return initDB('breakDB', 'breakDB') + .then( (dbRef) => { + expect(dbRef).toEqual(null); + }); }); \ No newline at end of file