-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/not working ci mode for draw io (#29)
* Fixed ci-mode drawio diagram generation broken after #28 * Added index.js tests to validate ci mode Co-authored-by: Adrian Nieto Perez <[email protected]>
- Loading branch information
1 parent
c7685bd
commit 591970e
Showing
2 changed files
with
42 additions
and
1 deletion.
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
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,36 @@ | ||
let os = require('os'); | ||
let path = require('path'); | ||
let exec = require('child_process').exec; | ||
|
||
test('Code should be 0', async () => { | ||
jest.setTimeout(30000); | ||
|
||
console.log("output path set to " + os.tmpdir() + '/template.drawio') | ||
let result = await cli(['draw.io', '--template-file', './tests/template.json', '--output-file', os.tmpdir() + '/template.drawio', '--ci-mode' ], '.'); | ||
console.log(result.stdout) | ||
console.log(result.stderr) | ||
expect(result.code).toBe(0); | ||
|
||
console.log("output path set to " + os.tmpdir()) | ||
result = await cli(['html', '--template-file', './tests/template.json', '--output-path', os.tmpdir(), '--ci-mode'], '.'); | ||
console.log(result.stdout) | ||
console.log(result.stderr) | ||
expect(result.code).toBe(0); | ||
|
||
}) | ||
|
||
|
||
function cli(args, cwd) { | ||
return new Promise(resolve => { | ||
exec(`node ${path.resolve('./index.js')} ${args.join(' ')}`, | ||
{ cwd }, | ||
(error, stdout, stderr) => { | ||
resolve({ | ||
code: error && error.code ? error.code : 0, | ||
error, | ||
stdout, | ||
stderr | ||
}) | ||
}) | ||
}) | ||
} |