Added logger for dealing with issue #179

Added markdown files for the documentation.
parseError exposed from the mermaidAPI
This commit is contained in:
knsv
2015-06-30 14:23:32 +02:00
parent 0dc983d04a
commit 6f96b5dd14
32 changed files with 1253 additions and 471 deletions

View File

@@ -5,6 +5,7 @@
* Created by knut on 14-11-23.
*/
var api = require('./mermaidAPI.js');
var log = require('./logger').create();
describe('when using mermaidAPI and ',function() {
describe('doing initialize ',function() {
@@ -52,4 +53,20 @@ describe('when using mermaidAPI and ',function() {
});
});
describe('checking validity of input ', function(){
it('it should return false for an invalid definiton',function(){
spyOn(global.mermaidAPI,'parseError');
var res = api.parse('this is not a mermaid diagram definition');
expect(res).toBe(false);
expect(global.mermaidAPI.parseError).toHaveBeenCalled();
});
it('it should return true for a valid definiton',function(){
spyOn(global.mermaidAPI,'parseError');
var res = mermaid.parse('graph TD;A--x|text including URL space|B;');
expect(res).toBe(true);
expect(global.mermaidAPI.parseError).not.toHaveBeenCalled();
});
});
});