JeremyYao commented on code in PR #1336:
URL: https://github.com/apache/daffodil-vscode/pull/1336#discussion_r2255063768


##########
src/utils.ts:
##########
@@ -441,11 +441,26 @@ export function getTDMLTestCaseItems(
   const xml_obj = parser.parse(fileData)
 
   // Read through TDML test cases and populate each TDML test case item if XML 
file is valid enough
-  if (Array.isArray(xml_obj['testSuite']?.['parserTestCase'])) {
+  if (
+    // Otherwise, it's an array
+    Array.isArray(xml_obj['testSuite']?.['parserTestCase'])
+  ) {
     return xml_obj['testSuite']['parserTestCase'].map((obj) => ({
       name: obj['@_name'],
       description: obj['@_description'],
     }))
+  } else if (
+    // One item results in an object type
+    xml_obj['testSuite']?.['parserTestCase'] &&
+    typeof xml_obj['testSuite']?.['parserTestCase'] == 'object'
+  ) {
+    const obj = xml_obj['testSuite']?.['parserTestCase']
+    return [
+      {
+        name: obj['@_name'],
+        description: obj['@_description'],
+      },
+    ]
   } else {

Review Comment:
   Lets hear others' perspectives on this. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to