diff --git a/seasoned_api/test/helpers/createCacheEntry.js b/seasoned_api/test/helpers/createCacheEntry.js index afc7889..4a9f8b8 100644 --- a/seasoned_api/test/helpers/createCacheEntry.js +++ b/seasoned_api/test/helpers/createCacheEntry.js @@ -2,8 +2,7 @@ const Cache = require('src/tmdb/cache'); const SqliteDatabase = require('src/database/sqliteDatabase'); function createCacheEntry(key, value) { - const database = new SqliteDatabase(':memory:'); - const cache = new Cache(database); + const cache = new Cache(); return cache.set(key, value); } diff --git a/seasoned_api/test/helpers/createUser.js b/seasoned_api/test/helpers/createUser.js index 417d71d..a22f2a4 100644 --- a/seasoned_api/test/helpers/createUser.js +++ b/seasoned_api/test/helpers/createUser.js @@ -1,12 +1,11 @@ const User = require('src/user/user'); const UserSecurity = require('src/user/userSecurity'); -const SqliteDatabase = require('src/database/sqliteDatabase'); -function createUser(username, email, password) { - const database = new SqliteDatabase(':memory:'); - const userSecurity = new UserSecurity(database); - const user = new User(username, email); - return userSecurity.createNewUser(user, password); +function createUser(username, password) { + const userSecurity = new UserSecurity(); + const user = new User(username) + + return Promise.resolve(userSecurity.createNewUser(user, password)) } module.exports = createUser; \ No newline at end of file diff --git a/seasoned_api/test/helpers/resetDatabase.js b/seasoned_api/test/helpers/resetDatabase.js index fdb5c0b..d65bb97 100644 --- a/seasoned_api/test/helpers/resetDatabase.js +++ b/seasoned_api/test/helpers/resetDatabase.js @@ -1,11 +1,9 @@ -const SqliteDatabase = require('src/database/sqliteDatabase'); +const establishedDatabase = require('src/database/database'); -function resetDatabase() { - const database = new SqliteDatabase(':memory:'); - return Promise.resolve() - .then(() => database.connect()) - // .then(() => database.tearDown()) - .then(() => database.setUp()); +function resetDatabase() { + return Promise.resolve() + .then(() => establishedDatabase.tearDown()) + .then(() => establishedDatabase.setUp()) } module.exports = resetDatabase;