Skip to content

Commit

Permalink
test: 💍 test footnote ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 1, 2019
1 parent f552d43 commit 9df5a8b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/__tests__/md/footnote-order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[^b]: Footnote b

Hello [^a][^b][^c]

[^c]: Footnote c

[^a]: Footnote a
11 changes: 11 additions & 0 deletions src/__tests__/mdastToFlat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,15 @@ describe('structure', () => {
footnoteOrder: [10, 19],
});
});

it('footnotes are ordered', () => {
const parser = create();
const md = fs.readFileSync(__dirname + '/md/footnote-order.md', 'utf8');
const mdast = parser.tokenizeBlock(md)!;
const flat = mdastToFlat(mdast);

expect(flat.footnotes.a).toBe(flat.footnoteOrder[0]);
expect(flat.footnotes.b).toBe(flat.footnoteOrder[1]);
expect(flat.footnotes.c).toBe(flat.footnoteOrder[2]);
});
});
2 changes: 1 addition & 1 deletion src/__tests__/replace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('structure', () => {
});
});

it.only('merges metadata', () => {
it('merges metadata', () => {
const parser = create();
const mdast1 = parser.tokenizeBlock(`
# Click [here][link1] world! [^foot]
Expand Down

0 comments on commit 9df5a8b

Please sign in to comment.