WRITE UNIT TESTS!!!
first async command working, no unit tests done AGAING
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user