Skip to content

Commit

Permalink
Merge branch 'riehlegroup:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-Hussein-OTH authored Nov 29, 2024
2 parents 0724cf1 + e42a56b commit 294ff8b
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions test/adap-b05/files/Files.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { describe, it, expect } from "vitest";

import { StringName } from "../../../src/adap-b05/names/StringName";

import { Node } from "../../../src/adap-b05/files/Node";
import { File } from "../../../src/adap-b05/files/File";
import { BuggyFile } from "../../../src/adap-b05/files/BuggyFile";
import { Directory } from "../../../src/adap-b05/files/Directory";
import { RootNode } from "../../../src/adap-b05/files/RootNode";

function createFileSystem(): RootNode {
let rn: RootNode = new RootNode();

let usr: Directory = new Directory("usr", rn);
let bin: Directory = new Directory("bin", usr);
let ls: File = new File("ls", bin);
let code: File = new File("code", bin);

let media: Directory = new Directory("media", rn);

let home: Directory = new Directory("home", rn);
let riehle: Directory = new Directory("riehle", home);
let bashrc: File = new File(".bashrc", riehle);
let wallpaper: File = new File("wallpaper.jpg", riehle);
let projects: Directory = new Directory("projects", riehle);

return rn;
}

describe("Basic naming test", () => {
it("test name checking", () => {
// let fs: RootNode = createFileSystem();
// let ls: Node = [...fs.findNodes("ls")][0];
// expect(ls.getFullName().isEqual(new StringName("/usr/bin/ls", '/')));
});
});

function createBuggySetup(): RootNode {
let rn: RootNode = new RootNode();

let usr: Directory = new Directory("usr", rn);
let bin: Directory = new Directory("bin", usr);
let ls: File = new BuggyFile("ls", bin);
let code: File = new BuggyFile("code", bin);

let media: Directory = new Directory("media", rn);

let home: Directory = new Directory("home", rn);
let riehle: Directory = new Directory("riehle", home);
let bashrc: File = new BuggyFile(".bashrc", riehle);
let wallpaper: File = new BuggyFile("wallpaper.jpg", riehle);
let projects: Directory = new Directory("projects", riehle);

return rn;
}

describe("Buggy setup test", () => {
it("test finding files", () => {
// let threwException: boolean = false;
// try {
// let fs: RootNode = createBuggySetup();
// fs.findNodes("ls");
// } catch(er) {
// threwException = true;
// let ex: Exception = er as Exception;
// expect(ex instanceof ServiceFailureException);
// expect(ex.hasTrigger());
// let tx: Exception = ex.getTrigger();
// expect(tx instanceof InvalidStateException);
// }
// expect(threwException);
});
});

0 comments on commit 294ff8b

Please sign in to comment.