fix unit test

This commit is contained in:
duanfuxiang
2025-04-08 14:53:05 +08:00
parent 5118b3e3a7
commit 520fe80d11
16 changed files with 79 additions and 462 deletions

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import JSON5 from 'json5'
import { parseFragment } from 'parse5'
@@ -375,6 +376,7 @@ export function parseMsgBlocks(
path = childNode.childNodes[0].value
} else if (childNode.nodeName === 'operations' && childNode.childNodes.length > 0) {
try {
// @ts-ignore
content = childNode.childNodes[0].value
operations = JSON5.parse(content)
} catch (error) {
@@ -408,8 +410,10 @@ export function parseMsgBlocks(
for (const childNode of node.childNodes) {
if (childNode.nodeName === 'path' && childNode.childNodes.length > 0) {
// @ts-ignore
path = childNode.childNodes[0].value
} else if (childNode.nodeName === 'diff' && childNode.childNodes.length > 0) {
// @ts-ignore
diff = childNode.childNodes[0].value
}
}
@@ -436,6 +440,7 @@ export function parseMsgBlocks(
let result: string | undefined
for (const childNode of node.childNodes) {
if (childNode.nodeName === 'result' && childNode.childNodes.length > 0) {
// @ts-ignore
result = childNode.childNodes[0].value
}
}
@@ -460,6 +465,7 @@ export function parseMsgBlocks(
let question: string | undefined
for (const childNode of node.childNodes) {
if (childNode.nodeName === 'question' && childNode.childNodes.length > 0) {
// @ts-ignore
question = childNode.childNodes[0].value
}
}
@@ -517,6 +523,7 @@ export function parseMsgBlocks(
let query: string | undefined
for (const childNode of node.childNodes) {
if (childNode.nodeName === 'query' && childNode.childNodes.length > 0) {
// @ts-ignore
query = childNode.childNodes[0].value
}
}
@@ -544,6 +551,7 @@ export function parseMsgBlocks(
for (const childNode of node.childNodes) {
if (childNode.nodeName === 'urls' && childNode.childNodes.length > 0) {
try {
// @ts-ignore
const urlsJson = childNode.childNodes[0].value
const parsedUrls = JSON5.parse(urlsJson)
if (Array.isArray(parsedUrls)) {