Skip to content

Commit

Permalink
Fix tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Mar 11, 2019
1 parent 02198ef commit 207a506
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions test/lib/processors/jsdoc/jsdocGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ test("generateJsdocConfig", async (t) => {
test.serial("writeJsdocConfig", async (t) => {
mock("graceful-fs", {
writeFile: (configPath, configContent, callback) => {
t.deepEqual(configPath, "/some/path/jsdoc-config.json", "Correct config path supplied");
t.deepEqual(configPath, path.join("/", "some", "path", "jsdoc-config.json"),
"Correct config path supplied");
t.deepEqual(configContent, "some config", "Correct config content supplied");
callback();
}
Expand All @@ -55,7 +56,7 @@ test.serial("writeJsdocConfig", async (t) => {
const jsdocGenerator = mock.reRequire("../../../../lib/processors/jsdoc/jsdocGenerator");
const res = await jsdocGenerator._writeJsdocConfig("/some/path", "some config");

t.deepEqual(res, "/some/path/jsdoc-config.json", "Correct config path returned");
t.deepEqual(res, path.join("/", "some", "path", "jsdoc-config.json"), "Correct config path returned");

mock.stop("graceful-fs");
});
Expand Down
10 changes: 7 additions & 3 deletions test/lib/tasks/generateJsdoc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const {test} = require("ava");
const sinon = require("sinon");
const tmp = require("tmp");
const path = require("path");

const mock = require("mock-require");

Expand Down Expand Up @@ -43,10 +44,13 @@ test.serial("createTmpDirs", async (t) => {

const res = await generateJsdoc._createTmpDirs("some.namespace");

t.deepEqual(res, {sourcePath: "/some/path/src", targetPath: "/some/path/target", tmpPath: "/some/path/tmp"},
"Correct temporary directories returned");
t.deepEqual(res, {
sourcePath: path.join("/", "some", "path", "src"),
targetPath: path.join("/", "some", "path", "target"),
tmpPath: path.join("/", "some", "path", "tmp")
}, "Correct temporary directories returned");
t.deepEqual(makeDirStub.callCount, 1, "One directory got created");
t.deepEqual(makeDirStub.getCall(0).args[0], "/some/path/tmp", "Correct dir path got created");
t.deepEqual(makeDirStub.getCall(0).args[0], path.join("/", "some", "path", "tmp"), "Correct dir path got created");

mock.stop("make-dir");
});
Expand Down

0 comments on commit 207a506

Please sign in to comment.