diff --git a/test/helpers/helpers.js b/test/helpers/helpers.js index 25f0f4b63c..5395a5310f 100644 --- a/test/helpers/helpers.js +++ b/test/helpers/helpers.js @@ -2,13 +2,13 @@ const marked = require('../../'); const HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer; const htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true}); -beforeEach(function () { +beforeEach(() => { marked.setOptions(marked.getDefaults()); jasmine.addMatchers({ - toRender: function () { + toRender: () => { return { - compare: function (spec, expected) { + compare: (spec, expected) => { const result = {}; const actual = marked(spec.markdown, spec.options); result.pass = htmlDiffer.isEqual(expected, actual); diff --git a/test/specs/original/specs-spec.js b/test/specs/original/specs-spec.js index d0869dd472..a3a1df437c 100644 --- a/test/specs/original/specs-spec.js +++ b/test/specs/original/specs-spec.js @@ -1,6 +1,6 @@ var specTests = require('../../'); -it('should run spec tests', function () { +it('should run spec tests', () => { // hide output spyOn(console, 'log'); if (!specTests(['', '', '--stop'])) { diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js index 809ae10ce2..b827a0dcf0 100644 --- a/test/specs/run-spec.js +++ b/test/specs/run-spec.js @@ -8,14 +8,14 @@ function runSpecs(title, file, options) { return obj; }, {}); - describe(title, function() { + describe(title, () => { Object.keys(specs).forEach(section => { - describe(section, function() { - specs[section].forEach(function(spec) { + describe(section, () => { + specs[section].forEach((spec) => { if (options) { spec.options = Object.assign({}, options, (spec.options || {})); } - (spec.only ? fit : it)('should ' + (spec.shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() { + (spec.only ? fit : it)('should ' + (spec.shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, () => { if (spec.shouldFail) { expect(spec).not.toRender(spec.html); } else { diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js index c365e8599c..994c5dc8d7 100644 --- a/test/unit/marked-spec.js +++ b/test/unit/marked-spec.js @@ -1,41 +1,41 @@ var marked = require('../../lib/marked.js'); -describe('Test heading ID functionality', function() { - it('should add id attribute by default', function() { +describe('Test heading ID functionality', () => { + it('should add id attribute by default', () => { var renderer = new marked.Renderer(); var slugger = new marked.Slugger(); var header = renderer.heading('test', 1, 'test', slugger); expect(header).toBe('

test

\n'); }); - it('should NOT add id attribute when options set false', function() { + it('should NOT add id attribute when options set false', () => { var renderer = new marked.Renderer({ headerIds: false }); var header = renderer.heading('test', 1, 'test'); expect(header).toBe('

test

\n'); }); }); -describe('Test slugger functionality', function() { - it('should use lowercase slug', function() { +describe('Test slugger functionality', () => { + it('should use lowercase slug', () => { var slugger = new marked.Slugger(); expect(slugger.slug('Test')).toBe('test'); }); - it('should be unique to avoid collisions 1280', function() { + it('should be unique to avoid collisions 1280', () => { var slugger = new marked.Slugger(); expect(slugger.slug('test')).toBe('test'); expect(slugger.slug('test')).toBe('test-1'); expect(slugger.slug('test')).toBe('test-2'); }); - it('should be unique when slug ends with number', function() { + it('should be unique when slug ends with number', () => { var slugger = new marked.Slugger(); expect(slugger.slug('test 1')).toBe('test-1'); expect(slugger.slug('test')).toBe('test'); expect(slugger.slug('test')).toBe('test-2'); }); - it('should be unique when slug ends with hyphen number', function() { + it('should be unique when slug ends with hyphen number', () => { var slugger = new marked.Slugger(); expect(slugger.slug('foo')).toBe('foo'); expect(slugger.slug('foo')).toBe('foo-1'); @@ -44,24 +44,24 @@ describe('Test slugger functionality', function() { expect(slugger.slug('foo')).toBe('foo-2'); }); - it('should allow non-latin chars', function() { + it('should allow non-latin chars', () => { var slugger = new marked.Slugger(); expect(slugger.slug('привет')).toBe('привет'); }); - it('should remove ampersands 857', function() { + it('should remove ampersands 857', () => { var slugger = new marked.Slugger(); expect(slugger.slug('This & That Section')).toBe('this--that-section'); }); - it('should remove periods', function() { + it('should remove periods', () => { var slugger = new marked.Slugger(); expect(slugger.slug('file.txt')).toBe('filetxt'); }); }); -describe('Test paragraph token type', function () { - it('should use the "paragraph" type on top level', function () { +describe('Test paragraph token type', () => { + it('should use the "paragraph" type on top level', () => { const md = 'A Paragraph.\n\n> A blockquote\n\n- list item\n'; const tokens = marked.lexer(md);