Skip to content

Commit 185dab3

Browse files
committed
update
1 parent 82ceef3 commit 185dab3

2 files changed

Lines changed: 3 additions & 40 deletions

File tree

deno.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"tasks": {
66
"dev": "deno test -E --watch",
77
"sample": "deno run -EN --watch sample/main.ts",
8-
"test": "deno test --allow-all",
9-
"test:doc": "deno test --doc --allow-all src/ mod.ts"
8+
"test": "deno test -E",
9+
"test:doc": "deno test --doc -E"
1010
},
1111
"test": {
1212
"include": ["mod_test.ts", "src/**/*_test.ts"]
@@ -27,6 +27,7 @@
2727
"dom",
2828
"dom.asynciterable",
2929
"dom.iterable",
30+
"deno.unstable",
3031
"deno.ns"
3132
],
3233
"jsx": "precompile",

mod_test.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,6 @@ function extractSessionCookie(
2727

2828
// Test secret key (32+ characters required)
2929
const TEST_SECRET = "this-is-a-test-secret-key-32chars!";
30-
Deno.test("use memory store", async () => {
31-
const store = new MemorySessionStore();
32-
const sessionSaveRes = await (async () => {
33-
const handler = new App<State>()
34-
.use(session(store, TEST_SECRET))
35-
.get("/", (ctx) => {
36-
ctx.state.session.set("userId", "user123");
37-
return new Response("Hello, World!");
38-
}).handler();
39-
const req = new Request("http://localhost");
40-
const res = await handler(req);
41-
42-
assertEquals(await res.text(), "Hello, World!");
43-
44-
return res;
45-
})();
46-
47-
const sessionCookie = extractSessionCookie(sessionSaveRes);
48-
49-
{
50-
const handler = new App<State>()
51-
.use(session(store, TEST_SECRET))
52-
.get("/get", (ctx) => {
53-
const userId = ctx.state.session.get("userId") as string | undefined;
54-
return new Response(userId ?? "No User");
55-
})
56-
.handler();
57-
58-
const req = new Request("http://localhost/get", {
59-
headers: {
60-
"Cookie": `fresh_session=${sessionCookie}`,
61-
},
62-
});
63-
const res = await handler(req);
64-
65-
assertEquals(await res.text(), "user123");
66-
}
67-
});
6830

6931
Deno.test("use cookie store", async () => {
7032
const store = new CookieSessionStore();

0 commit comments

Comments
 (0)