-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add identity lookup capability to build directory class node getter m…
…ethod
- Loading branch information
Showing
9 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const { Directory, File } = require("../../build/api"); | ||
|
||
|
||
const directory = new Directory("virtual/", [ | ||
new File("foo.txt", "FOO"), | ||
new File("bar.txt", "BAR"), | ||
new File("bar.txt", "BAZ"), | ||
new File("quux/foo.txt", "QUUX FOO"), | ||
]); | ||
|
||
new UnitTest("Directory nodes length") | ||
.actual(directory.nodes.length) | ||
.expect(4); | ||
|
||
new UnitTest("Directory pathmap size (no path duplicates)") | ||
.actual(directory.pathMap.size) | ||
.expect(3); | ||
|
||
new UnitTest("Directory .get('bar.txt')") | ||
.actual(directory.get("bar.txt")) | ||
.expect({ | ||
relativePath: "bar.txt", | ||
name: "bar", | ||
extension: "txt", | ||
contents: "BAZ" | ||
}); | ||
|
||
new UnitTest("Directory .get('quux/foo.txt')") | ||
.actual(directory.get("foo.txt")) | ||
.expect({ | ||
relativePath: "foo.txt", | ||
name: "foo", | ||
extension: "txt", | ||
contents: "FOO" | ||
}); | ||
|
||
new UnitTest("Directory .get('.') [identity]") | ||
.actual(directory.get(".").relativePath) | ||
.expect("virtual/"); | ||
|
||
|
||
const file = new File("virtual.js", "console.log('foo bar');"); | ||
|
||
new UnitTest("File meta") | ||
.actual({ | ||
name: file.name, | ||
extension: file.extension | ||
}) | ||
.expect({ | ||
name: "virtual", | ||
extension: "js" | ||
}); | ||
|
||
new UnitTest("File contents") | ||
.actual(file.contents) | ||
.expect("console.log('foo bar');"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters