Skip to content

Commit

Permalink
Add file write test
Browse files Browse the repository at this point in the history
  • Loading branch information
vn7n24fzkq committed Aug 29, 2020
1 parent 6063f63 commit 545c433
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/utils/svg-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ const fs = require("fs");
const outputPath = "./profile-summary-card-output/";
const writeSVG = function (folder,filename, svgString) {
const targetFolder = `${outputPath}${folder}/`
fs.mkdir(targetFolder, { recursive: true }, (err) => {
if (err) throw err;
fs.writeFileSync(`${targetFolder}${filename}.svg`, svgString, function (
err,
result
) {
if (err) throw (err);
});
fs.mkdirSync(targetFolder, { recursive: true });
fs.writeFileSync(`${targetFolder}${filename}.svg`, svgString, function (
err,
result
) {
if (err) throw (err);
});
};

Expand Down
1 change: 1 addition & 0 deletions tests/utils/svg-writer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { writeSVG, outputPath } = require("../../src/utils/svg-writer");
const fs = require("fs");


describe("Test output function", () => {
it("test write svg can work", () => {
writeSVG("test", "write-svg", "work");
Expand Down

0 comments on commit 545c433

Please sign in to comment.