ShellState, SessionState implemented, all tested, and passing
This commit is contained in:
@@ -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();
|
||||
});
|
||||
Reference in New Issue
Block a user