ShellState, SessionState implemented, all tested, and passing

This commit is contained in:
2026-07-25 03:37:13 +02:00
parent 0fce10895f
commit 994b93ae47
7 changed files with 275 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
import { addHistoryEntry, getHistoryEntry } from "@core/history_state";
import { expect, test } from "vitest";
const historyState: readonly string[] = ['echo "Hello World!"'];
test("addHistoryEntry - successfully adds an entry to the array", () => {
const state = addHistoryEntry(historyState, "ls -l");
expect(state).toEqual(['echo "Hello World!"', "ls -l"]);
});
test("getHistoryEntry - successfully adds returns an entry ", () => {
const state = getHistoryEntry(historyState, 0);
expect(state).toBe('echo "Hello World!"');
});
test("getHistoryEntry - throws an error because of a nonexistant history entry ", () => {
expect(() => getHistoryEntry(historyState, 999)).toThrow();
});