包管补齐mock

Signed-off-by: 耿文广 <gengwenguang@huawei.com>
This commit is contained in:
耿文广
2022-07-19 15:15:38 +08:00
parent cbaf71cc7c
commit 804dc39cae
7 changed files with 50 additions and 46 deletions
@@ -41,6 +41,9 @@ export const AbilityInfo = {
appId: '[PC Preview] unknow appId',
label: "[PC preview] unknown label",
description: "[PC preview] unknown description",
icon: "[PC preview] unknown icon",
labelId: "[PC preview] unknown labelId",
iconId: "[PC preview] unknown iconId",
uid: '[PC Preview] unknow uid',
installTime: '[PC Preview] unknow installTime',
updateTime: '[PC Preview] unknow updateTime',
@@ -39,7 +39,7 @@ export const BundleInfo = {
installTime: "[PC preview] unknown installTime",
updateTime: "[PC preview] unknown updateTime",
appInfo: ApplicationInfo,
abilityInfo: [AbilityInfo],
abilityInfos: [AbilityInfo],
reqPermissions: [paramMock.paramStringMock],
reqPermissionDetails: [ReqPermissionDetail],
vendor: "[PC preview] unknown vendor",
@@ -24,6 +24,7 @@ export const HashParam = {
export const InstallParam = {
userId: "[PC preview] unknown userId",
installFlag: "[PC preview] unknown installFlag",
isKeepData: "[PC preview] unknown isKeepData",
hashParams: [HashParam],
crowdtestDeadline: "[PC preview] unknown crowdtestDeadline",
}
@@ -15,6 +15,8 @@
import { paramMock } from "../../utils"
import { AbilityInfo } from './abilityInfo';
import { ExtensionAbilityInfo } from './extensionAbilityInfo';
import { Metadata } from './metadata';
export const HapModuleInfo = {
@@ -33,4 +35,7 @@ export const HapModuleInfo = {
moduleName: "[PC preview] unknown moduleName",
mainAbilityName: "[PC preview] unknown mainAbilityName",
installationFree: "[PC preview] unknown installationFree",
mainElementName: "[PC preview] unknown mainElementName",
extensionAbilityInfo: [ExtensionAbilityInfo],
metadata: [Metadata],
}
@@ -18,8 +18,8 @@ import { ApplicationInfo } from './applicationInfo';
import { ElementName } from './elementName'
export const LauncherAbilityInfo = {
applicationInfo: {ApplicationInfo},
elementName: {ElementName},
applicationInfo: ApplicationInfo,
elementName: ElementName,
labelId: "[PC preview] unknown labelId",
iconId: "[PC preview] unknown iconId",
userId: "[PC preview] unknown userId",
@@ -33,7 +33,7 @@ export const ModuleDistroInfo = {
export const AbilityFormInfo = {
name: "[PC preview] unknown name",
type: "[PC preview] unknown type",
updateEnabledtype: "[PC preview] unknown updateEnabled",
updateEnabled: "[PC preview] unknown updateEnabled",
scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime",
updateDuration: "[PC preview] unknown updateDuration",
supportDimensions: [paramMock.paramNumberMock],
@@ -13,57 +13,52 @@
* limitations under the License.
*/
export const MemLevel = {
MEM_LEVEL_MIN: 1,
MEM_LEVEL_MAX: 9,
MEM_LEVEL_DEFAULT: 8
MEM_LEVEL_MIN: 1,
MEM_LEVEL_MAX: 9,
MEM_LEVEL_DEFAULT: 8
};
export const ErrorCode = {
ERROR_CODE_OK: 0,
ERROR_CODE_ERRNO: -1,
ERROR_CODE_OK: 0,
ERROR_CODE_ERRNO: -1,
};
export const CompressLevel = {
COMPRESS_LEVEL_NO_COMPRESSION: 0,
COMPRESS_LEVEL_BEST_SPEED: 1,
COMPRESS_LEVEL_BEST_COMPRESSION: 9,
COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1
COMPRESS_LEVEL_NO_COMPRESSION: 0,
COMPRESS_LEVEL_BEST_SPEED: 1,
COMPRESS_LEVEL_BEST_COMPRESSION: 9,
COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1
};
export const CompressStrategy = {
COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0,
COMPRESS_STRATEGY_FILTERED: 1,
COMPRESS_STRATEGY_HUFFMAN_ONLY: 2,
COMPRESS_STRATEGY_RLE: 3,
COMPRESS_STRATEGY_FIXED: 4
COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0,
COMPRESS_STRATEGY_FILTERED: 1,
COMPRESS_STRATEGY_HUFFMAN_ONLY: 2,
COMPRESS_STRATEGY_RLE: 3,
COMPRESS_STRATEGY_FIXED: 4
};
export const Options = {
level: CompressLevel,
memLevel: MemLevel,
strategy: CompressStrategy,
level: CompressLevel,
memLevel: MemLevel,
strategy: CompressStrategy,
};
export function mockZlib() {
const zlib = {
ErrorCode,
MemLevel,
CompressLevel,
CompressStrategy,
Options: {
level: CompressLevel,
memLevel: MemLevel,
strategy: CompressStrategy,
},
zipFile(...args) {
console.warn("zlib.zipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.")
return new Promise((resolve, reject) => {
resolve()
})
},
export function mockZlib() {
const zlib = {
ErrorCode,
MemLevel,
CompressLevel,
CompressStrategy,
Options,
zipFile: function(...args) {
console.warn("zlib.zipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.")
return new Promise((resolve) => {
resolve();
})
},
unzipFile(...args) {
console.warn("zlib.unzipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.")
return new Promise((resolve, reject) => {
resolve()
})
unzipFile: function(...args) {
console.warn("zlib.unzipFile interface mocked in the Previewer. How this interface works on the Previewer may be different from that on a real device.")
return new Promise((resolve) => {
resolve();
})
}
}
}
return zlib;
return zlib;
}