WRITE UNIT TESTS!!!

first async command working, no unit tests done AGAING
This commit is contained in:
2026-08-23 06:39:37 +02:00
parent e313aa5b9d
commit 268729bb62
18 changed files with 331 additions and 93 deletions
+10 -2
View File
@@ -56,10 +56,18 @@ const state: ShellState = createInitialShellState(fs, users, user);
describe("Shell tests", () => {
test("Successfully executes the cd command", async () => {
await Shell.init(state);
const result = await Shell.Instance?.Execute("cd /sub");
let result;
Shell.Instance?.on("result", payload => {
console.log(payload);
result = payload.result;
});
await Shell.Instance?.execute("cd /sub");
const statee = Shell.Instance?.State;
expect(result?.type).toEqual("success");
expect(result!.type).toEqual("success");
expect(getCurrentSession(statee!).history.length).toBe(1);
expect(getCurrentSession(statee!).history[0]).toEqual("cd /sub");
expect(getCurrentSession(statee!).cwd).toBe(2);