Skip to content

Commit

Permalink
Switch from jest to mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
lewissteele committed Sep 16, 2024
1 parent f41a371 commit aea158e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/api/database.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const assert = require("node:assert");
const {
getConnection,
getDatabases,
saveDatabase,
} = require("../../src/api/database");

test("database connection is saved to file", async () => {
it("saves database connections to file", async () => {
const database = {
dialect: "sqlite",
storage: ":memory:",
Expand All @@ -13,11 +14,10 @@ test("database connection is saved to file", async () => {
await saveDatabase("test", database);

const databases = await getDatabases();

expect(databases["test"]).toEqual(database);
assert.notStrictEqual(databases["test"], database);
});

test("it can connect to database", async () => {
it("can connect to database", async () => {
await saveDatabase("test", {
dialect: "sqlite",
storage: ":memory:",
Expand Down
5 changes: 3 additions & 2 deletions test/api/history.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const assert = require("node:assert");
const { getHistory, pushToHistory } = require("../../src/api/history");

test("history saves to file", async () => {
it("saves history to file", async () => {
const query = "select * from test";

await pushToHistory(query);

const history = await getHistory();

expect(history.includes(query)).toBe(true);
assert(history.includes(query));
});
5 changes: 3 additions & 2 deletions test/hooks/config.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const assert = require("node:assert");
const configHook = require("../../src/hooks/config");

test("config hook", async () => {
it("sets config to global object", async () => {
const options = {
config: { configDir: "config" },
};

await configHook(options);

expect(global.config).toEqual(options.config);
assert.equal(global.config, options.config);
});

0 comments on commit aea158e

Please sign in to comment.