diff --git a/test/detached-anchor.test.ts b/test/detached-anchor.test.ts index 24507813..1111d0cd 100644 --- a/test/detached-anchor.test.ts +++ b/test/detached-anchor.test.ts @@ -1,7 +1,8 @@ import transform from '../src/transform'; import plugin from '../src/transform/plugins/detached-anchor'; +import anchorsPlugin from '../src/transform/plugins/anchors'; -const transformYfm = (text: string) => { +let transformYfm = (text: string) => { const { result: {html}, } = transform(text, { @@ -16,10 +17,19 @@ describe('detached-anchor', function () { expect(transformYfm('{#my-anchor}')).toBe(''); }); }); - describe('with heading', () => { + describe('with heading anchors', () => { + transformYfm = (text) => { + const { + result: {html}, + } = transform(text, {plugins: [plugin, anchorsPlugin]}); + return html; + }; it('does not conflict with heading anchors', () => { expect(transformYfm('# Heading {#heading-anchor} \n {#my-anchor}')).toBe( - '

Heading

\n', + '

' + + 'Heading

\n' + + '', ); }); });