Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/jupyter-api/chdir-commands.test.ts
1447 views
1
import cdcmd from "./chdir-commands";
2
3
describe("chdir-commands", () => {
4
test("bash", () => {
5
expect(cdcmd("bash", "/home/")).toBe("cd '/home/'");
6
expect(cdcmd("bash", "/home/foo'bar")).toBe("cd '/home/foo\\'bar'");
7
});
8
9
test("python", () => {
10
expect(cdcmd("python", "/home/")).toBe("import os; os.chdir('/home/')");
11
expect(cdcmd("python", "/home/foo'bar")).toBe(
12
"import os; os.chdir('/home/foo\\'bar')"
13
);
14
});
15
});
16
17