From c52f4d6307cae94bf509d8025edd81e510d3e3af Mon Sep 17 00:00:00 2001 From: Tyler Long Date: Thu, 14 Sep 2017 19:32:35 +0800 Subject: [PATCH] Repalce 'var ' with 'const ' --- src/mermaidAPI.spec.js | 10 +++++----- src/utils.spec.js | 29 ++++++++++++----------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/mermaidAPI.spec.js b/src/mermaidAPI.spec.js index 8522944b7..5ed3cbd5e 100644 --- a/src/mermaidAPI.spec.js +++ b/src/mermaidAPI.spec.js @@ -9,26 +9,26 @@ describe('when using mermaidAPI and ', function () { }) it('should copy a literal into the configuration', function () { - var orgConfig = mermaidAPI.getConfig() + const orgConfig = mermaidAPI.getConfig() expect(orgConfig.testLiteral).toBe(undefined) mermaidAPI.initialize({ 'testLiteral': true }) - var config = mermaidAPI.getConfig() + const config = mermaidAPI.getConfig() expect(config.testLiteral).toBe(true) }) it('should copy a an object into the configuration', function () { - var orgConfig = mermaidAPI.getConfig() + const orgConfig = mermaidAPI.getConfig() expect(orgConfig.testObject).toBe(undefined) - var object = { + const object = { test1: 1, test2: false } mermaidAPI.initialize({ 'testObject': object }) mermaidAPI.initialize({ 'testObject': { 'test3': true } }) - var config = mermaidAPI.getConfig() + const config = mermaidAPI.getConfig() expect(config.testObject.test1).toBe(1) expect(config.testObject.test2).toBe(false) diff --git a/src/utils.spec.js b/src/utils.spec.js index a8c464fc7..e37284e27 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -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) }) })