Skip to content

Commit

Permalink
Zygote descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
evgnomon committed Oct 13, 2024
1 parent d62381c commit ce7d689
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/database.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { DB } from "../lib/index.js";
describe("DB.query", function () {
/** @type {DB} */
let database;

before(function () {
database = new DB(1);
});

after(async function () {
await database.close();
});
Expand Down Expand Up @@ -227,12 +229,15 @@ describe("DB.query", function () {
for (const { query, results, fields } of testParameters) {
describe(`with ${query}`, function () {
let actualResults, actualFields;

before(async function () {
[actualResults, actualFields] = await database.query(query);
});

it("returns desired results", function () {
assert.deepStrictEqual(actualResults, results);
});

it("returns desired fields", function () {
assert.deepStrictEqual(
JSON.parse(JSON.stringify(actualFields)),
Expand Down
7 changes: 7 additions & 0 deletions test/mem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,31 @@ describe("MEM", function () {
const value = {
hello: "world",
};

before(async function () {
mem = await new MEM().connect();
});

after(async function () {
await mem.quit();
});

describe("set and get test-key", function () {
const testKey = "test-key";

before(async function () {
await mem.set(testKey, JSON.stringify(value));
});

it("returns the written test key", async function () {
const userSession = await mem.get(testKey);
assert.deepStrictEqual(userSession, JSON.stringify(value));
});

it("del key", async function () {
await mem.del(testKey);
});

it("doesn't return the deleted test key", async function () {
const userSession = await mem.get(testKey);
assert.notOk(userSession);
Expand Down

0 comments on commit ce7d689

Please sign in to comment.