11import { describe , expect , it } from 'vitest' ;
22
33describe ( 'markdown-table-matcher' , ( ) => {
4- it ( 'should match table rows' , ( ) => {
4+ it ( 'should match header and data rows in a markdown table ' , ( ) => {
55 const markdown = `
66 | 🏷 Category | ⭐ Score | 🛡 Audits |
77 | :-------------------------- | :-------: | :-------: |
@@ -15,6 +15,11 @@ describe('markdown-table-matcher', () => {
1515 '⭐ Score' ,
1616 '🛡 Audits' ,
1717 ] ) ;
18+ expect ( markdown ) . toContainMarkdownTableRow ( [
19+ ':--------------------------' ,
20+ ':-------:' ,
21+ ':-------:' ,
22+ ] ) ;
1823 expect ( markdown ) . toContainMarkdownTableRow ( [
1924 '[Performance](#performance)' ,
2025 '🟡 **64**' ,
@@ -27,7 +32,7 @@ describe('markdown-table-matcher', () => {
2732 ] ) ;
2833 } ) ;
2934
30- it ( 'should match table row with escaped pipe symbols' , ( ) => {
35+ it ( 'should match table rows containing escaped pipe symbols' , ( ) => {
3136 const markdown = `
3237 | Package | Versions |
3338 | :--------- | :----------------------- |
@@ -38,4 +43,18 @@ describe('markdown-table-matcher', () => {
3843 '`^8.0.0 || ^9.0.0`' ,
3944 ] ) ;
4045 } ) ;
46+
47+ it ( 'should match table rows with an empty cell' , ( ) => {
48+ const markdown = `
49+ | Severity | Message | Source file | Line(s) |
50+ | :--------: | :------------------------ | :-------------------- | :-----: |
51+ | 🚨 _error_ | File size is 20KB too big | \`list.component.ts\` | |
52+ ` ;
53+ expect ( markdown ) . toContainMarkdownTableRow ( [
54+ '🚨 _error_' ,
55+ 'File size is 20KB too big' ,
56+ '`list.component.ts`' ,
57+ '' ,
58+ ] ) ;
59+ } ) ;
4160} ) ;
0 commit comments