minor fixes, 1 test for session manager

This commit is contained in:
2026-07-30 18:00:01 +02:00
parent 5d197b4513
commit 3e6d607e18
2 changed files with 14 additions and 3 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import type { Result, ResultError, ResultSuccess, ShellError } from "@core/result";
import type { Result, ResultError, ResultSuccess } from "@core/result";
import type { ShellError } from "@core/util/errors";
import { createImmutableBuffer, type ImmutableBuffer } from "@core/util/immutable_buffer";
import { expect, test } from "vitest";
@@ -36,13 +37,13 @@ test("error result passed through getstdout should throw error with 'Goodbye, Wo
const result: ResultError<TestError> = {
type: "error",
exitCode: 1,
stdout: createImmutableBuffer(new Uint8Array()),
stderr: createImmutableBuffer(new Uint8Array()),
error: {
errorType: "TestError",
message,
timestamp: 0,
exitCode: 1,
},
};
expect(() => getStdout(result)).toThrow(message);
+11 -1
View File
@@ -1,5 +1,5 @@
import type { UserInfo } from "@core/session_manager";
import { createInitialSessionState, login } from "@core/session_manager";
import { createInitialSessionState, getCurrentSession, login } from "@core/session_manager";
import { createInitialShellState } from "@core/shell_state";
import { buildTestFS } from "@tests/helpers/filesystems_fixture";
import { depth7Tree } from "@tests/helpers/tree_fixture";
@@ -44,5 +44,15 @@ test("createInitialSessionState - successfully creates a new session state", ()
describe("login", () => {
test("it successfully starts a new session under the user test", () => {
const newState = login(state, "test", "321", passMap);
const pop = getCurrentSession(newState);
expect(pop.user).toEqual(testU);
});
test("", () => {
const newState = login(state, "test", "321", passMap);
const pop = getCurrentSession(newState);
expect(pop.user).toEqual(testU);
});
});