-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from amazingrando/master
Add the option to order file output
- Loading branch information
Showing
6 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ coverage/ | |
node_modules/ | ||
npm-debug.log | ||
.DS_STORE | ||
.vscode |
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,35 @@ | ||
var expect = require("chai").expect; | ||
var splitter = require("../src/splitter.js"); | ||
var shell = require("shelljs"); | ||
|
||
var readPath = "tests/testdata.md", | ||
pattern = "###", | ||
cleanName = "###", | ||
writePath = "tests/tmp/", | ||
numberFiles = true; | ||
|
||
describe("splitterWithCounter", function() { | ||
it("should split markdown file into smaller files", function(done) { | ||
shell.mkdir("-p", "tests/tmp"); | ||
splitter(readPath, pattern, cleanName, writePath, 10, numberFiles); | ||
var filez = shell.ls("tests/tmp/*.md"); | ||
console.log(filez); | ||
expect(filez).to.contain("tests/tmp/1-v0.0.1.md"); | ||
expect(filez).to.contain("tests/tmp/2-v0.0.2.md"); | ||
expect(filez).to.contain("tests/tmp/3-v0.0.3.md"); | ||
expect(filez).to.contain("tests/tmp/4-<empty-filename>.md"); | ||
shell.rm("-rf", "tests/tmp/"); | ||
done(); | ||
}); | ||
it("should throw error when given invalid file to read", function(done) { | ||
readPath = "blahblahblah"; | ||
expect( | ||
splitter.bind(splitter, readPath, pattern, cleanName, writePath) | ||
).to.throw(Error); | ||
done(); | ||
}); | ||
it("should exist", function(done) { | ||
expect(splitter).to.exist; | ||
done(); | ||
}); | ||
}); |
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