Skip to content

Commit

Permalink
update test because intentionally odd spacing got removed. also remov…
Browse files Browse the repository at this point in the history
…es additional test.
  • Loading branch information
Courey committed Jul 18, 2024
1 parent e2471ee commit bfa0505
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 73 deletions.
2 changes: 1 addition & 1 deletion src/replacements/gcn-circular/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ <h1>Hello, world</h1>
GCN circs #<data class="gcn-circular" value="123">123</data> #<data class="gcn-circular" value="456">456</data>
(GCN circs <data class="gcn-circular" value="123">123</data> <data class="gcn-circular" value="456">456</data>)
GCN #<data class="gcn-circular" value="123">123</data>
gcn <data class="gcn-circular" value="123">123</data></p>
gcn <data class="gcn-circular" value="123">123</data></p>
2 changes: 1 addition & 1 deletion src/replacements/gcn-circular/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@
},
{
"type": "text",
"value": "gcn "
"value": "gcn "
},
{
"type": "text",
Expand Down
71 changes: 0 additions & 71 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,75 +71,4 @@ describe.each([
expect(splitLines(result)).toStrictEqual(splitLines(expected))
}
)

test.each([
'GCN 123',
'GCN #123',
'(GCN 123)',
'(GCN #123)',
'GCN circ. 123',
'GCN circ. #123',
'(GCN circ. #123)',
'GCN circ 123',
'(GCN circ 123)',
'GCN Circ. 123',
'GCN Circ. #123',
'(GCN Circ. #123)',
'GCN Circ 123',
'(GCN Circ 123)',
'GCN Circular 123',
'GCN Circular #123',
'(GCN Circular 123)',
'(GCN Circular #123)',
'GCN Circs 123, 456',
'GCN Circs. 123, 456',
'GCN Circs #123, #456',
'(GCN Circs #123, #456)',
'(GCN Circs 123, 456)',
'GCN Circ 123, 456',
'GCN Circ. 123, 456',
'GCN Circ #123, #456',
'(GCN Circ 123, 456)',
'GCN circs 123, 456',
'GCN circs. 123, 456',
'GCN circs #123, #456',
'(GCN circs 123, 456)',
'GCN circs 123 and 456',
'GCN circs. 123 and 456',
'GCN circs #123 and #456',
'(GCN circs 123 and 456)',
'GCN circs 123 456',
'GCN circs. 123 456',
'GCN circs #123 #456',
'(GCN circs 123 456)',
'GCN #123',
'gcn 123',
])('GCN linking', async (testPattern) => {
const result = (
await processor().process(
`some preceding text ${testPattern} some following text.`
)
).value.toString()
const circularIdString = testPattern.match(/\d+/g)?.join(', ') || ''
const circularIdArray = circularIdString.split(',').map((x) => {
return x.trim()
})
for (const circularId of circularIdArray) {
const htmlResult = `<data class="gcn-circular" value="${circularId}">${circularId}`
const jsonResult = {
type: 'text',
value: circularId,
data: {
class: 'gcn-circular',
value: parseInt(circularId),
},
}
const expected = ext === 'html' ? htmlResult : JSON.stringify(jsonResult)
const formattedResult =
ext === 'html'
? result
: JSON.stringify(JSON.parse(result).children[0].children)
expect(formattedResult).toContain(expected)
}
})
})

0 comments on commit bfa0505

Please sign in to comment.