diff --git a/tests/cache.test.ts b/tests/cache.test.ts new file mode 100644 index 0000000..bbef70b --- /dev/null +++ b/tests/cache.test.ts @@ -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() \ No newline at end of file diff --git a/tests/session.test.ts b/tests/session.test.ts new file mode 100644 index 0000000..a6b15e8 --- /dev/null +++ b/tests/session.test.ts @@ -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");