mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 22:09:57 +02:00
#931 Last code standard fixes
This commit is contained in:
@@ -1,45 +1,45 @@
|
||||
/* eslint-env jasmine */
|
||||
import mermaidAPI from './mermaidAPI'
|
||||
import mermaidAPI from './mermaidAPI';
|
||||
|
||||
describe('when using mermaidAPI and ', function () {
|
||||
describe('doing initialize ', function () {
|
||||
beforeEach(function () {
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
describe('when using mermaidAPI and ', function() {
|
||||
describe('doing initialize ', function() {
|
||||
beforeEach(function() {
|
||||
document.body.innerHTML = '';
|
||||
});
|
||||
|
||||
it('should copy a literal into the configuration', function () {
|
||||
const orgConfig = mermaidAPI.getConfig()
|
||||
expect(orgConfig.testLiteral).toBe(undefined)
|
||||
it('should copy a literal into the configuration', function() {
|
||||
const orgConfig = mermaidAPI.getConfig();
|
||||
expect(orgConfig.testLiteral).toBe(undefined);
|
||||
|
||||
mermaidAPI.initialize({ 'testLiteral': true })
|
||||
const config = mermaidAPI.getConfig()
|
||||
mermaidAPI.initialize({ testLiteral: true });
|
||||
const config = mermaidAPI.getConfig();
|
||||
|
||||
expect(config.testLiteral).toBe(true)
|
||||
})
|
||||
it('should copy a an object into the configuration', function () {
|
||||
const orgConfig = mermaidAPI.getConfig()
|
||||
expect(orgConfig.testObject).toBe(undefined)
|
||||
expect(config.testLiteral).toBe(true);
|
||||
});
|
||||
it('should copy a an object into the configuration', function() {
|
||||
const orgConfig = mermaidAPI.getConfig();
|
||||
expect(orgConfig.testObject).toBe(undefined);
|
||||
|
||||
const object = {
|
||||
test1: 1,
|
||||
test2: false
|
||||
}
|
||||
};
|
||||
|
||||
mermaidAPI.initialize({ 'testObject': object })
|
||||
mermaidAPI.initialize({ 'testObject': { 'test3': true } })
|
||||
const config = mermaidAPI.getConfig()
|
||||
mermaidAPI.initialize({ testObject: object });
|
||||
mermaidAPI.initialize({ testObject: { test3: true } });
|
||||
const config = mermaidAPI.getConfig();
|
||||
|
||||
expect(config.testObject.test1).toBe(1)
|
||||
expect(config.testObject.test2).toBe(false)
|
||||
expect(config.testObject.test3).toBe(true)
|
||||
})
|
||||
})
|
||||
describe('checking validity of input ', function () {
|
||||
it('it should throw for an invalid definiton', function () {
|
||||
expect(() => mermaidAPI.parse('this is not a mermaid diagram definition')).toThrow()
|
||||
})
|
||||
it('it should not throw for a valid definiton', function () {
|
||||
expect(() => mermaidAPI.parse('graph TD;A--x|text including URL space|B;')).not.toThrow()
|
||||
})
|
||||
})
|
||||
})
|
||||
expect(config.testObject.test1).toBe(1);
|
||||
expect(config.testObject.test2).toBe(false);
|
||||
expect(config.testObject.test3).toBe(true);
|
||||
});
|
||||
});
|
||||
describe('checking validity of input ', function() {
|
||||
it('it should throw for an invalid definiton', function() {
|
||||
expect(() => mermaidAPI.parse('this is not a mermaid diagram definition')).toThrow();
|
||||
});
|
||||
it('it should not throw for a valid definiton', function() {
|
||||
expect(() => mermaidAPI.parse('graph TD;A--x|text including URL space|B;')).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user