Skip to content

Commit

Permalink
refactor: namings
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Jul 12, 2018
1 parent c2eaff3 commit 16e917d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/markdown/slugify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const mdS = Md().use(anchor, {
permalinkSymbol: '#'
})

const slugifyAsserts = {
/* markdown: id */
const asserts = {
/* header: slug */
'# a b': 'a-b',
'# a-b': 'a-b',
'# `<a>`': 'a',
Expand All @@ -19,14 +19,14 @@ const slugifyAsserts = {
}

describe('slugify', () => {
test('should convert headers correctly', () => {
for (const input in slugifyAsserts) {
test('should convert headers to slug correctly', () => {
for (const input in asserts) {
const output = mdS.render(input)
expect(getHeading(output)).toBe(slugifyAsserts[input])
expect(getSlug(output)).toBe(asserts[input])
}
})
})

function getHeading (output) {
function getSlug (output) {
return output.match(/id=\\?"([^"]*)\\?"/)[1]
}

0 comments on commit 16e917d

Please sign in to comment.