Files
termos/test/shell/shell.test.ts
T
ChaosMaker 55b5d3a873 - cleaned up old console logs that trashed the terminal
- adjusted the eslint config to include the `__` pattern for function arguments aswell
2026-08-28 17:03:12 +02:00

30 lines
1.1 KiB
TypeScript

import { getCurrentSession } from "@core/session_manager";
import { Shell } from "@shell/shell";
import { Fixture } from "@tests/helpers/state_fixture";
import { describe, expect, test } from "vitest";
const state = Fixture.State;
describe("Shell tests", () => {
test("Successfully executes the cd command", async () => {
await Shell.init(state);
let result;
Shell.Instance?.on("result", payload => {
result = payload.result;
});
await Shell.Instance?.execute("cd /folder1");
const statee = Shell.Instance?.State;
expect(result!.type).toEqual("success");
expect(getCurrentSession(statee!).history.length).toBe(1);
expect(getCurrentSession(statee!).history[0]).toEqual("cd /folder1");
expect(getCurrentSession(statee!).cwd).toBe(1);
expect(getCurrentSession(statee!).exitCode).toBe(0);
});
test("Returns a proper command error from cd", () => {});
test("Returns an empty success result as per parsing a whitespace character or inputing nothing", () => {});
});