Skip to content

Commit 458db07

Browse files
committed
SessionManager test ok
1 parent 706171c commit 458db07

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

nodeapp/lib/sessionManager.test.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
import { guard, sessionManager } from "./sessionManager.js";
1+
import { guard, middleware, useSessionInViews } from "./sessionManager.js";
22

33
describe("sessionManager", () => {
44
it("Deberia exportar guard como funcion", () => {
55
expect(typeof guard).toBe("function");
66
});
7+
8+
it("Deberia exportar middleware como funcion", () => {
9+
expect(typeof middleware).toBe("function");
10+
});
11+
12+
it("Deberia exportar useSessionInViews como funcion", () => {
13+
expect(typeof useSessionInViews).toBe("function");
14+
});
15+
16+
it("useSessionInViews deberia llamar siempre a la funcion next", () => {
17+
const next = jest.fn();
18+
const req = {};
19+
const res = { locals: {} };
20+
useSessionInViews(req, res, next);
21+
expect(next).toHaveBeenCalled();
22+
expect(next).toHaveBeenCalledTimes(1);
23+
});
724
});

0 commit comments

Comments
 (0)