Skip to content

Commit

Permalink
Working on tests for the new adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco5dev committed Jul 29, 2024
1 parent 944c7d3 commit 7c3fc41
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/cache.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import versedb from "../src/index";
const cache = new versedb.cache({
devLogs: { enable: false, path: "" },
dataPath: "./tests/cache/data",
maxSize: 1000,
ttl: 0,
});

cache.stats()
18 changes: 18 additions & 0 deletions tests/session.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import versedb from "../src/index";
const session = new versedb.session({
dataPath: `./tests/session/data`,
devLogs: { enable: true, path: `./tests/session/logs` },
secure: {
enable: false,
secret: "",
},
});

// Get a session
const sessionData = await session.load("sessionId1");
console.log(sessionData);
// Set a session
await session.add("sessionId1", { user: "John Doe", role: "admin" });

// Destroy a session
await session.destroy("sessionId1");

0 comments on commit 7c3fc41

Please sign in to comment.