Skip to content

Commit

Permalink
Add test for old issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 22, 2019
1 parent 360f909 commit 275d147
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/old-issues.js
@@ -0,0 +1,32 @@
import { promises as fs } from "fs";
import { dirname, join } from "path";
import { fileURLToPath } from "url";

import yuml2svg from "../index.mjs";

const __dirname = dirname(fileURLToPath(import.meta.url));

const inputDir = join(__dirname, "old_issues");

export default fs.readdir(inputDir).then(files =>
Promise.all(
files
.filter(filename => filename.endsWith(".yuml"))
.map(filename => join(inputDir, filename))
.map(path =>
Promise.all([
fs
.readFile(path)
.then(input => yuml2svg(input))
.then(Buffer.from),
fs.readFile(path + ".svg"),
]).then(([actualOutput, expectedOutput]) => {
if (Buffer.compare(actualOutput, expectedOutput) === 0) {
return Promise.resolve("Success");
} else {
return Promise.reject("An old bug file as been modified");
}
})
)
)
);
2 changes: 2 additions & 0 deletions test/old_issues/chinese-text-bug.yuml
@@ -0,0 +1,2 @@
// {type:state}
{start}[start]->(你好!)
19 changes: 19 additions & 0 deletions test/old_issues/chinese-text-bug.yuml.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions test/old_issues/class-notes-bug.yuml
@@ -0,0 +1,5 @@
// {type:class}
// {direction:topDown}
[note: You can stick notes on diagrams too!{bg:cornsilk}]
[Customer]<>1-orders 0..*>[Order]
[Order]-[note:asdf]
56 changes: 56 additions & 0 deletions test/old_issues/class-notes-bug.yuml.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 275d147

Please sign in to comment.