logout test written, green
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { UserInfo } from "@core/session_manager";
|
||||
import { createInitialSessionState, getCurrentSession, login } from "@core/session_manager";
|
||||
import { createInitialSessionState, getCurrentSession, login, logout } from "@core/session_manager";
|
||||
import { createInitialShellState } from "@core/shell_state";
|
||||
import { buildTestFS } from "@tests/helpers/filesystems_fixture";
|
||||
import { depth7Tree } from "@tests/helpers/tree_fixture";
|
||||
@@ -74,3 +74,17 @@ describe("login", () => {
|
||||
expect(() => login(state, "no user", "321", passMap)).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("logout", () => {
|
||||
test("returns the state with the current user poped from the stack", () => {
|
||||
const newState = login(state, "test", "321", passMap);
|
||||
const newPop = getCurrentSession(newState);
|
||||
|
||||
expect(newPop.user).toEqual(testU);
|
||||
|
||||
const newNewState = logout(state);
|
||||
const pop = getCurrentSession(newNewState);
|
||||
|
||||
expect(pop.user).toEqual(root);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user