From e67fa1937510b6c9f6283bc3b7809d60201a55dc Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 28 Aug 2019 13:43:06 +0200 Subject: [PATCH] Run lebab on test folder: convert let/const and arrow functions --- test/Node.test.js | 74 ++++++++++----------- test/jsonUtils.test.js | 26 ++++---- test/setup.js | 4 +- test/util.test.js | 142 ++++++++++++++++++++--------------------- 4 files changed, 123 insertions(+), 123 deletions(-) diff --git a/test/Node.test.js b/test/Node.test.js index 5a04ee5..97d2719 100644 --- a/test/Node.test.js +++ b/test/Node.test.js @@ -1,13 +1,13 @@ -var assert = require('assert') -var setUpTestEnvironment = require('./setup') +const assert = require('assert') +const setUpTestEnvironment = require('./setup') setUpTestEnvironment() -var Node = require('../src/js/Node') +const Node = require('../src/js/Node') -describe('Node', function () { - describe('_findSchema', function () { - it('should find schema', function () { - var schema = { +describe('Node', () => { + describe('_findSchema', () => { + it('should find schema', () => { + const schema = { type: 'object', properties: { child: { @@ -15,12 +15,12 @@ describe('Node', function () { } } } - var path = ['child'] + const path = ['child'] assert.strictEqual(Node._findSchema(schema, {}, path), schema.properties.child) }) - it('should find schema inside an array item', function () { - var schema = { + it('should find schema inside an array item', () => { + const schema = { properties: { job: { type: 'array', @@ -47,8 +47,8 @@ describe('Node', function () { schema.properties.job.items.properties.company) }) - it('should find schema within multi-level object properties', function () { - var schema = { + it('should find schema within multi-level object properties', () => { + const schema = { type: 'object', properties: { levelTwo: { @@ -66,7 +66,7 @@ describe('Node', function () { } } } - var path = [] + let path = [] assert.strictEqual(Node._findSchema(schema, {}, path), schema) path = ['levelTwo'] assert.strictEqual(Node._findSchema(schema, {}, path), schema.properties.levelTwo) @@ -79,8 +79,8 @@ describe('Node', function () { ) }) - it('should return null for path that has no schema', function () { - var schema = { + it('should return null for path that has no schema', () => { + const schema = { type: 'object', properties: { foo: { @@ -93,15 +93,15 @@ describe('Node', function () { } } } - var path = ['bar'] + let path = ['bar'] assert.strictEqual(Node._findSchema(schema, {}, path), null) path = ['foo', 'bar'] assert.strictEqual(Node._findSchema(schema, {}, path), null) }) - describe('with $ref', function () { - it('should find a referenced schema', function () { - var schema = { + describe('with $ref', () => { + it('should find a referenced schema', () => { + const schema = { type: 'object', properties: { foo: { @@ -109,18 +109,18 @@ describe('Node', function () { } } } - var fooSchema = { + const fooSchema = { type: 'number', title: 'Foo' } - var path = ['foo'] + const path = ['foo'] assert.strictEqual(Node._findSchema(schema, { foo: fooSchema }, path), fooSchema) }) }) - describe('with pattern properties', function () { - it('should find schema', function () { - var schema = { + describe('with pattern properties', () => { + it('should find schema', () => { + const schema = { type: 'object', properties: { str: { @@ -135,14 +135,14 @@ describe('Node', function () { } } } - var path = [] + let path = [] assert.strictEqual(Node._findSchema(schema, {}, path), schema, 'top level') path = ['str'] assert.strictEqual(Node._findSchema(schema, {}, path), schema.properties.str, 'normal property') }) - it('should find schema within multi-level object properties', function () { - var schema = { + it('should find schema within multi-level object properties', () => { + const schema = { type: 'object', properties: { levelTwo: { @@ -167,7 +167,7 @@ describe('Node', function () { } } } - var path = [] + let path = [] assert.strictEqual(Node._findSchema(schema, {}, path), schema, 'top level') path = ['levelTwo'] assert.strictEqual(Node._findSchema(schema, {}, path), schema.properties.levelTwo, 'level two') @@ -181,8 +181,8 @@ describe('Node', function () { ) }) - it('should find schema for pattern properties', function () { - var schema = { + it('should find schema for pattern properties', () => { + const schema = { type: 'object', patternProperties: { '^foo[0-9]': { @@ -195,7 +195,7 @@ describe('Node', function () { } } } - var path = ['foo1'] + let path = ['foo1'] assert.strictEqual( Node._findSchema(schema, {}, path), schema.patternProperties['^foo[0-9]'], @@ -209,8 +209,8 @@ describe('Node', function () { ) }) - it('should find schema for multi-level pattern properties', function () { - var schema = { + it('should find schema for multi-level pattern properties', () => { + const schema = { type: 'object', patternProperties: { '^foo[0-9]': { @@ -239,7 +239,7 @@ describe('Node', function () { } } } - var path = ['foo1', 'fooChild', 'fooChild2'] + let path = ['foo1', 'fooChild', 'fooChild2'] assert.strictEqual( Node._findSchema(schema, {}, path), schema.patternProperties['^foo[0-9]'].properties.fooChild.properties.fooChild2, @@ -253,8 +253,8 @@ describe('Node', function () { ) }) - it('should return null for path that has no schema', function () { - var schema = { + it('should return null for path that has no schema', () => { + const schema = { type: 'object', properties: { levelTwo: { @@ -277,7 +277,7 @@ describe('Node', function () { } } } - var path = ['not-in-schema'] + let path = ['not-in-schema'] assert.strictEqual(Node._findSchema(schema, {}, path), null) path = ['levelOne', 'not-in-schema'] assert.strictEqual(Node._findSchema(schema, {}, path), null) diff --git a/test/jsonUtils.test.js b/test/jsonUtils.test.js index a2c4822..d654e36 100644 --- a/test/jsonUtils.test.js +++ b/test/jsonUtils.test.js @@ -1,10 +1,10 @@ -var assert = require('assert') -var stringifyPartial = require('../src/js/jsonUtils').stringifyPartial -var containsArray = require('../src/js/jsonUtils').containsArray +const assert = require('assert') +const stringifyPartial = require('../src/js/jsonUtils').stringifyPartial +const containsArray = require('../src/js/jsonUtils').containsArray -describe('jsonUtils', function () { - it('should stringify a small object', function () { - var json = { +describe('jsonUtils', () => { + it('should stringify a small object', () => { + const json = { a: 2, b: 'foo', c: null, @@ -16,8 +16,8 @@ describe('jsonUtils', function () { assert.strictEqual(stringifyPartial(json), '{"a":2,"b":"foo","c":null,"d":false,"e":[1,2,3],"f":{"g":"h"}}') }) - it('should stringify a small object with formatting', function () { - var json = { + it('should stringify a small object with formatting', () => { + const json = { a: 2, b: 'foo', c: null, @@ -58,8 +58,8 @@ describe('jsonUtils', function () { '}') }) - it('should limit stringified output', function () { - var json = { + it('should limit stringified output', () => { + const json = { a: 2, b: 'foo', c: null, @@ -68,8 +68,8 @@ describe('jsonUtils', function () { f: { g: 'h' } } - var all = '{"a":2,"b":"foo","c":null,"d":false,"e":[1,2,3],"f":{"g":"h"}}' - var limit = 20 + const all = '{"a":2,"b":"foo","c":null,"d":false,"e":[1,2,3],"f":{"g":"h"}}' + const limit = 20 assert.strictEqual(stringifyPartial(json, undefined, limit), all.slice(0, limit) + '...') @@ -82,7 +82,7 @@ describe('jsonUtils', function () { assert.strictEqual(stringifyPartial(12345678, undefined, 4), '1234...') }) - it('should count array items', function () { + it('should count array items', () => { // assert.strictEqual(countArrayItems('[1,2,3]'), 3) assert.strictEqual(containsArray('[]'), true) assert.strictEqual(containsArray(' []'), true) diff --git a/test/setup.js b/test/setup.js index 642315f..c7801d5 100644 --- a/test/setup.js +++ b/test/setup.js @@ -1,4 +1,4 @@ -var JSDOM = require('jsdom').JSDOM +const JSDOM = require('jsdom').JSDOM /** * Set up the test environment by simulating browser globals. @@ -10,7 +10,7 @@ module.exports = function setUpTestEnvironment (locale) { locale = 'en' } - var dom = new JSDOM('...') + const dom = new JSDOM('...') global.window = dom.window global.document = dom.window.document global.navigator = dom.window.navigator diff --git a/test/util.test.js b/test/util.test.js index 901e5f8..ba3fc92 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -1,13 +1,13 @@ -var assert = require('assert') -var util = require('../src/js/util') +const assert = require('assert') +const util = require('../src/js/util') -describe('util', function () { - describe('repair', function () { - it('should leave valid JSON as is', function () { +describe('util', () => { + describe('repair', () => { + it('should leave valid JSON as is', () => { assert.strictEqual(util.repair('{"a":2}'), '{"a":2}') }) - it('should replace JavaScript with JSON', function () { + it('should replace JavaScript with JSON', () => { assert.strictEqual(util.repair('{a:2}'), '{"a":2}') assert.strictEqual(util.repair('{a: 2}'), '{"a": 2}') assert.strictEqual(util.repair('{\n a: 2\n}'), '{\n "a": 2\n}') @@ -19,7 +19,7 @@ describe('util', function () { assert.strictEqual(util.repair('"{a:b}"'), '"{a:b}"') }) - it('should add/remove escape characters', function () { + it('should add/remove escape characters', () => { assert.strictEqual(util.repair('"foo\'bar"'), '"foo\'bar"') assert.strictEqual(util.repair('"foo\\"bar"'), '"foo\\"bar"') assert.strictEqual(util.repair('\'foo"bar\''), '"foo\\"bar"') @@ -27,12 +27,12 @@ describe('util', function () { assert.strictEqual(util.repair('"foo\\\'bar"'), '"foo\'bar"') }) - it('should replace special white characters', function () { + it('should replace special white characters', () => { assert.strictEqual(util.repair('{"a":\u00a0"foo\u00a0bar"}'), '{"a": "foo\u00a0bar"}') assert.strictEqual(util.repair('{"a":\u2009"foo"}'), '{"a": "foo"}') }) - it('should escape unescaped control characters', function () { + it('should escape unescaped control characters', () => { assert.strictEqual(util.repair('"hello\bworld"'), '"hello\\bworld"') assert.strictEqual(util.repair('"hello\fworld"'), '"hello\\fworld"') assert.strictEqual(util.repair('"hello\nworld"'), '"hello\\nworld"') @@ -41,13 +41,13 @@ describe('util', function () { assert.strictEqual(util.repair('{"value\n": "dc=hcm,dc=com"}'), '{"value\\n": "dc=hcm,dc=com"}') }) - it('should replace left/right quotes', function () { + it('should replace left/right quotes', () => { assert.strictEqual(util.repair('\u2018foo\u2019'), '"foo"') assert.strictEqual(util.repair('\u201Cfoo\u201D'), '"foo"') assert.strictEqual(util.repair('\u0060foo\u00B4'), '"foo"') }) - it('remove comments', function () { + it('remove comments', () => { assert.strictEqual(util.repair('/* foo */ {}'), ' {}') assert.strictEqual(util.repair('/* foo */ {}'), ' {}') assert.strictEqual(util.repair('{a:\'foo\',/*hello*/b:\'bar\'}'), '{"a":"foo","b":"bar"}') @@ -57,7 +57,7 @@ describe('util', function () { assert.strictEqual(util.repair('{"str":"/* foo */"}'), '{"str":"/* foo */"}') }) - it('should strip JSONP notation', function () { + it('should strip JSONP notation', () => { // matching assert.strictEqual(util.repair('callback_123({});'), '{}') assert.strictEqual(util.repair('callback_123([]);'), '[]') @@ -78,7 +78,7 @@ describe('util', function () { assert.strictEqual(util.repair('callback({}'), 'callback({}') }) - it('should strip trailing zeros', function () { + it('should strip trailing zeros', () => { // matching assert.strictEqual(util.repair('[1,2,3,]'), '[1,2,3]') assert.strictEqual(util.repair('[1,2,3,\n]'), '[1,2,3\n]') @@ -90,8 +90,8 @@ describe('util', function () { assert.strictEqual(util.repair('"{a:2,}"'), '"{a:2,}"') }) - it('should strip MongoDB data types', function () { - var mongoDocument = '{\n' + + it('should strip MongoDB data types', () => { + const mongoDocument = '{\n' + ' "_id" : ObjectId("123"),\n' + ' "isoDate" : ISODate("2012-12-19T06:01:17.171Z"),\n' + ' "regularNumber" : 67,\n' + @@ -103,7 +103,7 @@ describe('util', function () { ' "decimal2" : NumberDecimal(4)\n' + '}' - var expectedJson = '{\n' + + const expectedJson = '{\n' + ' "_id" : "123",\n' + ' "isoDate" : "2012-12-19T06:01:17.171Z",\n' + ' "regularNumber" : 67,\n' + @@ -119,8 +119,8 @@ describe('util', function () { }) }) - describe('jsonPath', function () { - it('should stringify an array of paths', function () { + describe('jsonPath', () => { + it('should stringify an array of paths', () => { assert.deepStrictEqual(util.stringifyPath([]), '') assert.deepStrictEqual(util.stringifyPath(['foo']), '.foo') assert.deepStrictEqual(util.stringifyPath(['foo', 'bar']), '.foo.bar') @@ -132,7 +132,7 @@ describe('util', function () { assert.deepStrictEqual(util.stringifyPath(['foo', 'prop with spaces']), '.foo["prop with spaces"]') }) - it('should parse a json path', function () { + it('should parse a json path', () => { assert.deepStrictEqual(util.parsePath(''), []) assert.deepStrictEqual(util.parsePath('.foo'), ['foo']) assert.deepStrictEqual(util.parsePath('.foo.bar'), ['foo', 'bar']) @@ -146,36 +146,36 @@ describe('util', function () { assert.deepStrictEqual(util.parsePath('[2]'), [2]) }) - it('should throw an exception in case of an invalid path', function () { - assert.throws(function () { util.parsePath('.') }, /Invalid JSON path: property name expected at index 1/) - assert.throws(function () { util.parsePath('[') }, /Invalid JSON path: unexpected end, character ] expected/) - assert.throws(function () { util.parsePath('[]') }, /Invalid JSON path: array value expected at index 1/) - assert.throws(function () { util.parsePath('.foo[ ]') }, /Invalid JSON path: array value expected at index 7/) - assert.throws(function () { util.parsePath('.[]') }, /Invalid JSON path: property name expected at index 1/) - assert.throws(function () { util.parsePath('["23]') }, /Invalid JSON path: unexpected end, character " expected/) - assert.throws(function () { util.parsePath('.foo bar') }, /Invalid JSON path: unexpected character " " at index 4/) + it('should throw an exception in case of an invalid path', () => { + assert.throws(() => { util.parsePath('.') }, /Invalid JSON path: property name expected at index 1/) + assert.throws(() => { util.parsePath('[') }, /Invalid JSON path: unexpected end, character ] expected/) + assert.throws(() => { util.parsePath('[]') }, /Invalid JSON path: array value expected at index 1/) + assert.throws(() => { util.parsePath('.foo[ ]') }, /Invalid JSON path: array value expected at index 7/) + assert.throws(() => { util.parsePath('.[]') }, /Invalid JSON path: property name expected at index 1/) + assert.throws(() => { util.parsePath('["23]') }, /Invalid JSON path: unexpected end, character " expected/) + assert.throws(() => { util.parsePath('.foo bar') }, /Invalid JSON path: unexpected character " " at index 4/) }) }) - describe('getIndexForPosition', function () { - var el = { + describe('getIndexForPosition', () => { + const el = { value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' } - it('happy flows - row and column in range', function () { + it('happy flows - row and column in range', () => { assert.strictEqual(util.getIndexForPosition(el, 1, 1), 0) assert.strictEqual(util.getIndexForPosition(el, 2, 1), 124) assert.strictEqual(util.getIndexForPosition(el, 3, 8), 239) assert.strictEqual(util.getIndexForPosition(el, 4, 22), 356) }) - it('if range exceeds it should be considered as if it is last row or column length', function () { + it('if range exceeds it should be considered as if it is last row or column length', () => { assert.strictEqual(util.getIndexForPosition(el, 1, 100000), 123) assert.strictEqual(util.getIndexForPosition(el, 100000, 1), 335) assert.strictEqual(util.getIndexForPosition(el, 100000, 100000), 445) }) - it('missing or wrong input sould return -1', function () { + it('missing or wrong input sould return -1', () => { assert.strictEqual(util.getIndexForPosition(el), -1) assert.strictEqual(util.getIndexForPosition(el, undefined, 1), -1) assert.strictEqual(util.getIndexForPosition(el, 1, undefined), -1) @@ -183,9 +183,9 @@ describe('util', function () { }) }) - describe('get', function () { - it('should get a nested property from an object', function () { - var obj = { + describe('get', () => { + it('should get a nested property from an object', () => { + const obj = { a: { b: 2 }, @@ -205,34 +205,34 @@ describe('util', function () { }) }) - describe('makeFieldTooltip', function () { - it('should return empty string when the schema is missing all relevant fields', function () { + describe('makeFieldTooltip', () => { + it('should return empty string when the schema is missing all relevant fields', () => { assert.strictEqual(util.makeFieldTooltip({}), '') assert.strictEqual(util.makeFieldTooltip({ additionalProperties: false }), '') assert.strictEqual(util.makeFieldTooltip(), '') }) - it('should make tooltips with only title', function () { + it('should make tooltips with only title', () => { assert.strictEqual(util.makeFieldTooltip({ title: 'foo' }), 'foo') }) - it('should make tooltips with only description', function () { + it('should make tooltips with only description', () => { assert.strictEqual(util.makeFieldTooltip({ description: 'foo' }), 'foo') }) - it('should make tooltips with only default', function () { + it('should make tooltips with only default', () => { assert.strictEqual(util.makeFieldTooltip({ default: 'foo' }), 'Default\n"foo"') }) - it('should make tooltips with only examples', function () { + it('should make tooltips with only examples', () => { assert.strictEqual(util.makeFieldTooltip({ examples: ['foo', 'bar'] }), 'Examples\n"foo"\n"bar"') }) - it('should make tooltips with title and description', function () { + it('should make tooltips with title and description', () => { assert.strictEqual(util.makeFieldTooltip({ title: 'foo', description: 'bar' }), 'foo\nbar') - var longTitle = 'Lorem Ipsum Dolor' - var longDescription = 'Duis id elit non ante gravida vestibulum non nec est. ' + + const longTitle = 'Lorem Ipsum Dolor' + const longDescription = 'Duis id elit non ante gravida vestibulum non nec est. ' + 'Proin vitae ligula at elit dapibus tempor. ' + 'Etiam lacinia augue vel condimentum interdum. ' assert.strictEqual( @@ -241,39 +241,39 @@ describe('util', function () { ) }) - it('should make tooltips with title, description, and examples', function () { + it('should make tooltips with title, description, and examples', () => { assert.strictEqual( util.makeFieldTooltip({ title: 'foo', description: 'bar', examples: ['baz'] }), 'foo\nbar\n\nExamples\n"baz"' ) }) - it('should make tooltips with title, description, default, and examples', function () { + it('should make tooltips with title, description, default, and examples', () => { assert.strictEqual( util.makeFieldTooltip({ title: 'foo', description: 'bar', default: 'bat', examples: ['baz'] }), 'foo\nbar\n\nDefault\n"bat"\n\nExamples\n"baz"' ) }) - it('should handle empty fields', function () { + it('should handle empty fields', () => { assert.strictEqual(util.makeFieldTooltip({ title: '', description: 'bar' }), 'bar') assert.strictEqual(util.makeFieldTooltip({ title: 'foo', description: '' }), 'foo') assert.strictEqual(util.makeFieldTooltip({ description: 'bar', examples: [] }), 'bar') assert.strictEqual(util.makeFieldTooltip({ description: 'bar', examples: [''] }), 'bar\n\nExamples\n""') }) - it('should internationalize "Defaults" correctly', function () { + it('should internationalize "Defaults" correctly', () => { assert.strictEqual(util.makeFieldTooltip({ default: 'foo' }, 'pt-BR'), 'Revelia\n"foo"') }) - it('should internationalize "Examples" correctly', function () { + it('should internationalize "Examples" correctly', () => { assert.strictEqual(util.makeFieldTooltip({ examples: ['foo'] }, 'pt-BR'), 'Exemplos\n"foo"') }) }) - describe('getChildPaths', function () { - it('should extract all child paths of an array containing objects', function () { - var json = [ + describe('getChildPaths', () => { + it('should extract all child paths of an array containing objects', () => { + const json = [ { name: 'A', location: { latitude: 1, longitude: 2 } }, { name: 'B', location: { latitude: 1, longitude: 2 } }, { name: 'C', timestamp: 0 } @@ -287,8 +287,8 @@ describe('util', function () { ]) }) - it('should extract all child paths of an array containing objects, including objects', function () { - var json = [ + it('should extract all child paths of an array containing objects, including objects', () => { + const json = [ { name: 'A', location: { latitude: 1, longitude: 2 } }, { name: 'B', location: { latitude: 1, longitude: 2 } }, { name: 'C', timestamp: 0 } @@ -304,22 +304,22 @@ describe('util', function () { ]) }) - it('should extract all child paths of an array containing values', function () { - var json = [1, 2, 3] + it('should extract all child paths of an array containing values', () => { + const json = [1, 2, 3] assert.deepStrictEqual(util.getChildPaths(json), [ '' ]) }) - it('should extract all child paths of a non-array', function () { + it('should extract all child paths of a non-array', () => { assert.deepStrictEqual(util.getChildPaths({ a: 2, b: { c: 3 } }), ['']) assert.deepStrictEqual(util.getChildPaths('foo'), ['']) assert.deepStrictEqual(util.getChildPaths(123), ['']) }) }) - it('should test whether something is an object', function () { + it('should test whether something is an object', () => { assert.strictEqual(util.isObject({}), true) assert.strictEqual(util.isObject(new Date()), true) assert.strictEqual(util.isObject([]), false) @@ -329,15 +329,15 @@ describe('util', function () { assert.strictEqual(util.isObject(), false) }) - describe('sort', function () { - it('should sort an array', function () { - var array = [4, 1, 10, 2] + describe('sort', () => { + it('should sort an array', () => { + const array = [4, 1, 10, 2] assert.deepStrictEqual(util.sort(array), [1, 2, 4, 10]) assert.deepStrictEqual(util.sort(array, '.', 'desc'), [10, 4, 2, 1]) }) - it('should sort an array containing objects', function () { - var array = [ + it('should sort an array containing objects', () => { + const array = [ { value: 4 }, { value: 1 }, { value: 10 }, @@ -360,9 +360,9 @@ describe('util', function () { }) }) - describe('sortObjectKeys', function () { - it('should sort the keys of an object', function () { - var object = { + describe('sortObjectKeys', () => { + it('should sort the keys of an object', () => { + const object = { c: 'c', a: 'a', b: 'b' @@ -374,7 +374,7 @@ describe('util', function () { }) }) - it('should parse a string', function () { + it('should parse a string', () => { assert.strictEqual(util.parseString('foo'), 'foo') assert.strictEqual(util.parseString('234foo'), '234foo') assert.strictEqual(util.parseString('2.3'), 2.3) @@ -383,7 +383,7 @@ describe('util', function () { assert.strictEqual(util.parseString('false'), false) }) - it('should find a unique name', function () { + it('should find a unique name', () => { assert.strictEqual(util.findUniqueName('other', [ 'a', 'b', @@ -428,7 +428,7 @@ describe('util', function () { ]), 'b (copy 3)') }) - it('should format a document size in a human readable way', function () { + it('should format a document size in a human readable way', () => { assert.strictEqual(util.formatSize(500), '500 B') assert.strictEqual(util.formatSize(900), '0.9 KiB') assert.strictEqual(util.formatSize(77.89 * 1024), '77.9 KiB') @@ -439,13 +439,13 @@ describe('util', function () { assert.strictEqual(util.formatSize(1024 * 1024 * 1024 * 1024), '1.0 TiB') }) - it('should limit characters', function () { + it('should limit characters', () => { assert.strictEqual(util.limitCharacters('hello world', 11), 'hello world') assert.strictEqual(util.limitCharacters('hello world', 5), 'hello...') assert.strictEqual(util.limitCharacters('hello world', 100), 'hello world') }) - it('should compile a JSON pointer', function () { + it('should compile a JSON pointer', () => { assert.strictEqual(util.compileJSONPointer(['foo', 'bar']), '/foo/bar') assert.strictEqual(util.compileJSONPointer(['foo', '/~ ~/']), '/foo/~1~0 ~0~1') assert.strictEqual(util.compileJSONPointer(['']), '/')