mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 22:39:56 +02:00
Repalce 'var ' with 'const '
This commit is contained in:
@@ -2,43 +2,38 @@
|
||||
import utils from './utils'
|
||||
|
||||
describe('when detecting chart type ', function () {
|
||||
var str
|
||||
it('should handle a graph defintion', function () {
|
||||
str = 'graph TB\nbfs1:queue'
|
||||
|
||||
var type = utils.detectType(str)
|
||||
const str = 'graph TB\nbfs1:queue'
|
||||
const type = utils.detectType(str)
|
||||
expect(type).toBe('graph')
|
||||
})
|
||||
it('should handle a graph defintion with leading spaces', function () {
|
||||
str = ' graph TB\nbfs1:queue'
|
||||
|
||||
var type = utils.detectType(str)
|
||||
const str = ' graph TB\nbfs1:queue'
|
||||
const type = utils.detectType(str)
|
||||
expect(type).toBe('graph')
|
||||
})
|
||||
|
||||
it('should handle a graph defintion with leading spaces and newline', function () {
|
||||
str = ' \n graph TB\nbfs1:queue'
|
||||
|
||||
var type = utils.detectType(str)
|
||||
const str = ' \n graph TB\nbfs1:queue'
|
||||
const type = utils.detectType(str)
|
||||
expect(type).toBe('graph')
|
||||
})
|
||||
it('should handle a graph defintion for gitGraph', function () {
|
||||
str = ' \n gitGraph TB:\nbfs1:queue'
|
||||
|
||||
var type = utils.detectType(str)
|
||||
const str = ' \n gitGraph TB:\nbfs1:queue'
|
||||
const type = utils.detectType(str)
|
||||
expect(type).toBe('gitGraph')
|
||||
})
|
||||
})
|
||||
|
||||
describe('when finding substring in array ', function () {
|
||||
it('should return the array index that contains the substring', function () {
|
||||
var arr = ['stroke:val1', 'fill:val2']
|
||||
var result = utils.isSubstringInArray('fill', arr)
|
||||
const arr = ['stroke:val1', 'fill:val2']
|
||||
const result = utils.isSubstringInArray('fill', arr)
|
||||
expect(result).toEqual(1)
|
||||
})
|
||||
it('should return -1 if the substring is not found in the array', function () {
|
||||
var arr = ['stroke:val1', 'stroke-width:val2']
|
||||
var result = utils.isSubstringInArray('fill', arr)
|
||||
const arr = ['stroke:val1', 'stroke-width:val2']
|
||||
const result = utils.isSubstringInArray('fill', arr)
|
||||
expect(result).toEqual(-1)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user