未验证 提交 a74e28b4 编写于 作者: O openharmony_ci 提交者: Gitee

!795 monthly1018分支解决返回值ArrayBuffer类型时mock报错问题

Merge pull request !795 from fupengfei/monthly_20221018
......@@ -44,8 +44,14 @@ export function getReturnStatement(returnType: ReturnTypeEntity, sourceFile: Sou
return `return '[PC Preview] unkonwn type'`;
} else if (returnType.returnKindName === 'String') {
return `return ${returnType.returnKindName}(...args)`;
} else if (returnType.returnKindName === 'ArrayBuffer') {
return `return new ${returnType.returnKindName}(0)`;
} else if (returnType.returnKindName.startsWith('Array')) {
return `return [${generateGenericTypeToMockValue(returnType.returnKindName)}]`;
if (returnType.returnKindName.includes('<') && returnType.returnKindName.includes('>')) {
return `return [${generateGenericTypeToMockValue(returnType.returnKindName)}]`;
} else {
return `return new ${returnType.returnKindName}()`;
}
} else if (returnType.returnKindName.startsWith('Readonly')) {
return `return ${returnType.returnKindName.split('<')[1].split('>')[0]}`;
} else if (checkIsGenericSymbol(returnType.returnKindName)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册