!782 master分支解决system部分有实际实现的接口被mock掉了

Merge pull request !782 from fupengfei/master
This commit is contained in:
openharmony_ci 2023-01-19 02:19:36 +00:00 committed by Gitee
commit 3104153eba
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -14,6 +14,8 @@
*/
const systemIndexArray: Array<SystemIndexEntity> = [];
const systemNoMockArray = ['system.app', 'system.configuration', 'system.device',
'system.mediaquery', 'system.prompt', 'system.router'];
export function addToSystemIndexArray(systemIndexEntity: SystemIndexEntity) {
systemIndexArray.push(systemIndexEntity);
@ -31,8 +33,10 @@ export function generateSystemIndex(): string {
let systemIndex = `import regeneratorRuntime from 'babel-runtime/regenerator'\n`;
let exportFunction = '';
systemIndexArray.forEach(value => {
systemIndex += `import { ${value.mockFunctionName} } from './${value.filename}'\n`;
exportFunction += `${value.mockFunctionName}();\n`;
if (!systemNoMockArray.includes(value.filename.replace('_', '.'))) {
systemIndex += `import { ${value.mockFunctionName} } from './${value.filename}'\n`;
exportFunction += `${value.mockFunctionName}();\n`;
}
});
systemIndex += `import {mockRequireNapiFun} from './napi/index';\n`;
systemIndex += `export function mockSystemPlugin() {