Update unit tests to mock datasets properly

This commit is contained in:
Kiana Sheibani 2023-10-13 22:26:56 -04:00
parent de9e668a72
commit 56bb676545
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -488,16 +488,19 @@ pub mod tests {
// Mock a database file in transient memory // Mock a database file in transient memory
pub fn mock_datasets() -> sqlite::Result<Connection> { pub fn mock_datasets() -> sqlite::Result<Connection> {
let query = " let query = "PRAGMA foreign_keys = ON;
PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS datasets ( CREATE TABLE IF NOT EXISTS datasets (
name TEXT UNIQUE NOT NULL, name TEXT UNIQUE NOT NULL,
last_sync INTEGER NOT NULL, last_sync INTEGER NOT NULL,
game_id INTEGER NOT NULL, game_id INTEGER NOT NULL,
game_name TEXT NOT NULL, game_name TEXT NOT NULL,
state TEXT country TEXT,
) STRICT;"; state TEXT,
decay_rate REAL NOT NULL,
period REAL NOT NULL,
tau REAL NOT NULL
) STRICT;";
let connection = sqlite::open(":memory:")?; let connection = sqlite::open(":memory:")?;
connection.execute(query)?; connection.execute(query)?;