@@ -102,6 +102,47 @@ async function runTests() {
102102 assert ( regions . some ( r => r . regionName === 'Central US' ) , 'Should have Central US' ) ;
103103 } ) ;
104104
105+ // Regression: M365 page wraps a "note" admonition in <table class="Note">
106+ // immediately before the data table. Those rows must not leak through as regions.
107+ // See issues #95, #96.
108+ await test ( 'parseRegionTable ignores <table class="Note"> admonitions' , async ( ) => {
109+ const sampleHtml = `
110+ <p>Intro paragraph.</p>
111+ <div><table border="0" cellspacing="0" cellpadding="0" class="Note">
112+ <tr style="vertical-align:top">
113+ <td><p class="T_NoteType"><span class="T_NoteType">note</span></p></td>
114+ </tr>
115+ <tr style="vertical-align:top">
116+ <td><p class="Notes"><span class="Notes">Express backup data is stored in the Microsoft-specific region based on your configuration.</span></p></td>
117+ </tr>
118+ </table></div>
119+ <div><table border="0" cellspacing="0" cellpadding="0" class="Blue_Table">
120+ <caption>Backup Storage Regions</caption>
121+ <tr><th><p>Global Region</p></th><th><p>Azure Region</p></th></tr>
122+ <tr><td rowspan="2"><p>AMER</p></td><td><p>East US</p></td></tr>
123+ <tr><td><p>West US</p></td></tr>
124+ </table></div>
125+ ` ;
126+
127+ const regions = parseRegionTable ( sampleHtml , 'vdc_m365' ) ;
128+
129+ assertEqual ( regions . length , 2 , `Should parse exactly 2 regions, got ${ regions . length } ` ) ;
130+ assert ( regions . some ( r => r . regionName === 'East US' ) , 'Should have East US' ) ;
131+ assert ( regions . some ( r => r . regionName === 'West US' ) , 'Should have West US' ) ;
132+ assert ( ! regions . some ( r => r . regionName === 'note' ) , 'Must not parse "note" as a region' ) ;
133+ assert ( ! regions . some ( r => / E x p r e s s b a c k u p / . test ( r . regionName ) ) , 'Must not parse note body as a region' ) ;
134+ } ) ;
135+
136+ // Defensive: if the page structure changes and no Blue_Table is found, return [].
137+ await test ( 'parseRegionTable returns empty when no Blue_Table is present' , async ( ) => {
138+ const sampleHtml = `
139+ <table class="Note"><tr><td>note</td></tr></table>
140+ <table class="SomeOtherClass"><tr><td>East US</td></tr></table>
141+ ` ;
142+ const regions = parseRegionTable ( sampleHtml , 'vdc_m365' ) ;
143+ assertEqual ( regions . length , 0 , 'Should return no regions when no Blue_Table is present' ) ;
144+ } ) ;
145+
105146 // Test 3: findMatchingRegion function
106147 await test ( 'findMatchingRegion finds regions by ID' , async ( ) => {
107148 const scrapedRegion = {
0 commit comments