Merge pull request #146 from ags1773/fix-test

fix: path to db file in test
This commit is contained in:
Stefan Scherer 2021-11-12 09:23:50 +01:00 committed by GitHub
commit a1b127be03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
const db = require('../../src/persistence/sqlite'); const db = require('../../src/persistence/sqlite');
const fs = require('fs'); const fs = require('fs');
const location = process.env.SQLITE_DB_LOCATION || '/etc/todos/todo.db';
const ITEM = { const ITEM = {
id: '7aef3d7c-d301-4846-8358-2a91ec9d6be3', id: '7aef3d7c-d301-4846-8358-2a91ec9d6be3',
@ -8,8 +9,8 @@ const ITEM = {
}; };
beforeEach(() => { beforeEach(() => {
if (fs.existsSync('/etc/todos/todo.db')) { if (fs.existsSync(location)) {
fs.unlinkSync('/etc/todos/todo.db'); fs.unlinkSync(location);
} }
}); });