minor fixes, 1 test for session manager
This commit is contained in:
@@ -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 { createImmutableBuffer, type ImmutableBuffer } from "@core/util/immutable_buffer";
|
||||||
import { expect, test } from "vitest";
|
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> = {
|
const result: ResultError<TestError> = {
|
||||||
type: "error",
|
type: "error",
|
||||||
exitCode: 1,
|
|
||||||
stdout: createImmutableBuffer(new Uint8Array()),
|
stdout: createImmutableBuffer(new Uint8Array()),
|
||||||
stderr: createImmutableBuffer(new Uint8Array()),
|
stderr: createImmutableBuffer(new Uint8Array()),
|
||||||
error: {
|
error: {
|
||||||
errorType: "TestError",
|
errorType: "TestError",
|
||||||
message,
|
message,
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
|
exitCode: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(() => getStdout(result)).toThrow(message);
|
expect(() => getStdout(result)).toThrow(message);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { UserInfo } from "@core/session_manager";
|
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 { createInitialShellState } from "@core/shell_state";
|
||||||
import { buildTestFS } from "@tests/helpers/filesystems_fixture";
|
import { buildTestFS } from "@tests/helpers/filesystems_fixture";
|
||||||
import { depth7Tree } from "@tests/helpers/tree_fixture";
|
import { depth7Tree } from "@tests/helpers/tree_fixture";
|
||||||
@@ -44,5 +44,15 @@ test("createInitialSessionState - successfully creates a new session state", ()
|
|||||||
describe("login", () => {
|
describe("login", () => {
|
||||||
test("it successfully starts a new session under the user test", () => {
|
test("it successfully starts a new session under the user test", () => {
|
||||||
const newState = login(state, "test", "321", passMap);
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user