diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js index 2581a6d57f..2f88258133 100644 --- a/test/unit/marked-spec.js +++ b/test/unit/marked-spec.js @@ -75,6 +75,17 @@ describe('Test slugger functionality', () => { expect(slugger.slug('

This Section

')).toBe('this-section'); expect(slugger.slug('

This Section

', { dryrun: true })).toBe('this-section-1'); }); + + it('should be repeatable in a sequence', () => { + const slugger = new marked.Slugger(); + expect(slugger.slug('foo')).toBe('foo'); + expect(slugger.slug('foo')).toBe('foo-1'); + expect(slugger.slug('foo')).toBe('foo-2'); + expect(slugger.slug('foo', { dryrun: true })).toBe('foo-3'); + expect(slugger.slug('foo', { dryrun: true })).toBe('foo-3'); + expect(slugger.slug('foo')).toBe('foo-3'); + expect(slugger.slug('foo')).toBe('foo-4'); + }); }); describe('Test paragraph token type', () => {