Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions tests/connection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { config } from "https://deno.land/x/dotenv/mod.ts";
import { Database } from "../mod.ts";
import { Database, MySQLConnector, SQLite3Connector } from "../mod.ts";

const env = config();

Expand All @@ -16,25 +16,21 @@ const defaultSQLiteOptions = {
};

const getMySQLConnection = (options = {}, debug = true): Database => {
const connection: Database = new Database(
{ dialect: "mysql", debug },
{
...defaultMySQLOptions,
...options,
},
);
const connector = new MySQLConnector({
...defaultMySQLOptions,
...options,
});
const connection: Database = new Database({ connector, debug });

return connection;
};

const getSQLiteConnection = (options = {}, debug = true): Database => {
const connection: Database = new Database(
{ dialect: "sqlite3", debug },
{
...defaultSQLiteOptions,
...options,
},
);
const connector = new SQLite3Connector({
...defaultSQLiteOptions,
...options,
});
const connection: Database = new Database({ connector, debug });

return connection;
};
Expand Down