I've a simple spec file to run JEST:
describe('config', () => {
it('should be able to open database', () => {
console.log(SQLite);
SQLite.openDatabase(
{
name: 'TestDB',
createFromLocation: '~/www/test.db'
},
() => console.log('success'),
() => console.log('fail')
);
});
});
I want to write test which can open a pre-populated test.db (created using DB Browser for SQlite). DB is within ./www/test.db relative to the location of spec file. When I run SQLite.openDatabase, it fails with following error:
TypeError: Cannot read property 'open' of undefined
Eventually, I want to write a library to access data from sqlite as needed by a react-native app. However, this is the basic test which blocks further work.