From 1d71d6275fdf8baa7dde8df0de81a49c92b1d0fe Mon Sep 17 00:00:00 2001 From: nan-xiansen Date: Mon, 18 Oct 2021 15:14:35 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20af565d7=20from=20https://gitee.com/nan-?= =?UTF-8?q?xiansen/xts=5Facts/pulls/903=20=E3=80=90startup=5Fstanard?= =?UTF-8?q?=E3=80=91=E3=80=90master=E3=80=91fix=20docs=20issues.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nan-xiansen Change-Id: I6d546777ebf287ddc5c4c3889b71bffd13fadd92 --- .../src/main/js/default/pages/index/index.js | 1 + .../js/default/test/DeviceInfoJsUnit.test.js | 290 ++++++++++-------- 2 files changed, 160 insertions(+), 131 deletions(-) diff --git a/startup/startup_standard/src/main/js/default/pages/index/index.js b/startup/startup_standard/src/main/js/default/pages/index/index.js index 0c564bb03..173f299a3 100644 --- a/startup/startup_standard/src/main/js/default/pages/index/index.js +++ b/startup/startup_standard/src/main/js/default/pages/index/index.js @@ -35,6 +35,7 @@ export default { core.init() const configService = core.getDefaultService('config') + this.timeout = 5000 configService.setConfig(this) require('../../test/List.test') diff --git a/startup/startup_standard/src/main/js/default/test/DeviceInfoJsUnit.test.js b/startup/startup_standard/src/main/js/default/test/DeviceInfoJsUnit.test.js index 15cd24f0b..c771670da 100644 --- a/startup/startup_standard/src/main/js/default/test/DeviceInfoJsUnit.test.js +++ b/startup/startup_standard/src/main/js/default/test/DeviceInfoJsUnit.test.js @@ -14,7 +14,7 @@ */ // @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import deviceinfo from '@ohos.deviceInfo' describe('DeviceInfoTest', function () { @@ -52,15 +52,15 @@ describe('DeviceInfoTest', function () { */ it('device_info_test_001', 0, function () { console.info('device_info_test_001 start'); - let ret = false; + let ret = false; let deviceTypeInfo = deviceinfo.deviceType; console.info('the value of the deviceType is :' + deviceTypeInfo); expect(deviceTypeInfo).assertInstanceOf('String'); - if (deviceTypeInfo !="" && deviceTypeInfo != null && deviceTypeInfo != undefined) { + if (deviceTypeInfo != "" && deviceTypeInfo != null && deviceTypeInfo != undefined) { ret = true; } - expect(ret).assertTrue() + expect(ret).assertTrue() console.info('device_info_test_001 : end'); }) @@ -74,329 +74,329 @@ describe('DeviceInfoTest', function () { */ it('device_info_test_002', 0, function () { console.info('device_info_test_002 start'); - let ret = false; - let manufactureInfo = deviceinfo.manufacture; + let ret = false; + let manufactureInfo = deviceinfo.manufacture; console.info('the value of the manufactureInfo is :' + manufactureInfo); expect(manufactureInfo).assertInstanceOf('String'); - if (manufactureInfo !="" && manufactureInfo != null && manufactureInfo != undefined){ + if (manufactureInfo != "" && manufactureInfo != null && manufactureInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('device_info_test_002 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0300 - * @tc.name testGetProductBrand01 - * @tc.desc Get the product brand represented by a string. + * @tc.name testGetBrand01 + * @tc.desc Get the device brand represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_003', 0, function () { - console.info('testGetProductBrand01 start'); - let ret = false; + console.info('testGetDeviceBrand01 start'); + let ret = false; let brandInfo = deviceinfo.brand; - console.info('the value of the deviceinfo brand is :' + brandInfo); + console.info('the value of the device brand is :' + brandInfo); expect(brandInfo).assertInstanceOf('String'); - if (brandInfo !="" && brandInfo != null && brandInfo != undefined){ + if (brandInfo != "" && brandInfo != null && brandInfo != undefined) { ret = true; } - expect(ret).assertTrue(); - console.info('testGetProductBrand01 :end'); + expect(ret).assertTrue(); + console.info('testGetDeviceBrand01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0400 * @tc.name testGetMarketName01 - * @tc.desc Get the external product family name represented by a string. + * @tc.desc Get the external product family name represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_004', 0, function () { console.info('testGetMarketName01 start') - let ret = false; + let ret = false; let marketNameInfo = deviceinfo.marketName; console.info('the value of the deviceinfo marketName is :' + marketNameInfo); expect(marketNameInfo).assertInstanceOf('String'); - if(marketNameInfo !="" && marketNameInfo != null && marketNameInfo != undefined){ + if (marketNameInfo != "" && marketNameInfo != null && marketNameInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetMarketName01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0500 * @tc.name testGetProductSeries01 - * @tc.desc Get the product series represented by a string. + * @tc.desc Get the product series represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_005', 0, function () { console.info('testGetProductSeries01 start'); - let ret = false; + let ret = false; let productSeriesInfo = deviceinfo.productSeries; console.info('the value of the deviceinfo productSeries is :' + productSeriesInfo); expect(productSeriesInfo).assertInstanceOf('String'); - if(productSeriesInfo !="" && productSeriesInfo != null && productSeriesInfo != undefined){ + if (productSeriesInfo != "" && productSeriesInfo != null && productSeriesInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetProductSeries01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0600 * @tc.name testGetProductModel01 - * @tc.desc Get the internal software sub-model represented by a string. + * @tc.desc Get the internal software sub-model represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_006', 0, function () { console.info('testGetProductModel01 start'); - let ret = false; + let ret = false; let productModelInfo = deviceinfo.productModel; console.info('the value of the deviceinfo productModel is :' + productModelInfo); expect(productModelInfo).assertInstanceOf('String'); - if(productModelInfo !="" && productModelInfo != null && productModelInfo != undefined){ - ret =true; + if (productModelInfo != "" && productModelInfo != null && productModelInfo != undefined) { + ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetProductModel01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0700 * @tc.name testGetSoftwareModel01 - * @tc.desc Get the internal software sub-model represented by a string. + * @tc.desc Get the internal software sub-model represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_007', 0, function () { console.info('testGetSoftwareModel01 start'); - let ret = false; + let ret = false; let softwareModelInfo = deviceinfo.softwareModel; console.info('the value of the deviceinfo softwareModel is :' + softwareModelInfo); expect(softwareModelInfo).assertInstanceOf('String'); - if(softwareModelInfo !="" && softwareModelInfo != null && softwareModelInfo != undefined){ + if (softwareModelInfo != "" && softwareModelInfo != null && softwareModelInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetSoftwareModel01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0800 * @tc.name testGetHardWareModel01 - * @tc.desc Get the hardware version represented by a string. + * @tc.desc Get the hardware version represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_008', 0, function () { console.info('testGetHardWareModel01 start'); - let ret = false; + let ret = false; let hardwareModelInfo = deviceinfo.hardwareModel; console.info('the value of the deviceinfo hardwareModel is :' + hardwareModelInfo); expect(hardwareModelInfo).assertInstanceOf('String'); - if(hardwareModelInfo !="" && hardwareModelInfo != null && hardwareModelInfo != undefined){ + if (hardwareModelInfo != "" && hardwareModelInfo != null && hardwareModelInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetHardWareModel01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0900 * @tc.name testGetHardWareProfile01 - * @tc.desc Get the hardware profile represented by a string. + * @tc.desc Get the hardware profile represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_009', 0, function () { console.info('testGetHardWareProfile01 start'); - let ret = false; + let ret = false; let hardwareProfileInfo = deviceinfo.hardwareProfile; console.info('the value of the deviceinfo hardwareProfile is :' + hardwareProfileInfo); expect(hardwareProfileInfo).assertInstanceOf('String'); - if(hardwareProfileInfo !="" && hardwareProfileInfo != null && hardwareProfileInfo != undefined){ + if (hardwareProfileInfo != "" && hardwareProfileInfo != null && hardwareProfileInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetHardWareProfile01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0110 * @tc.name testGetSerial01 - * @tc.desc Get the device serial number represented by a string. + * @tc.desc Get the device serial number represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_010', 0, function () { console.info('testGetSerial01 start'); - let ret = false; + let ret = false; let serialInfo = deviceinfo.serial; console.info('the value of the deviceinfo serial is :' + serialInfo); expect(serialInfo).assertInstanceOf('String'); - if(serialInfo !="" && serialInfo != null && serialInfo != undefined){ + if (serialInfo != "" && serialInfo != null && serialInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetSerial01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0120 * @tc.name testGetBootLoaderVersion01 - * @tc.desc Get the bootloader version number represented by a string. + * @tc.desc Get the bootloader version number represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_011', 0, function () { console.info('testGetBootLoaderVersion01 start'); - let ret = false; + let ret = false; let bootloaderVersionInfo = deviceinfo.bootloaderVersion; console.info('the value of the deviceinfo bootloaderVersion is :' + bootloaderVersionInfo); expect(bootloaderVersionInfo).assertInstanceOf('String'); - if(bootloaderVersionInfo !="" && bootloaderVersionInfo != null && bootloaderVersionInfo != undefined){ + if (bootloaderVersionInfo != "" && bootloaderVersionInfo != null && bootloaderVersionInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBootLoaderVersion01 :end') }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0130 * @tc.name testGetabiList01 - * @tc.desc Get the instruction set supported by the system. + * @tc.desc Get the instruction set supported by the system and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_012', 0, function () { console.info('testGetabiList01 start'); - let ret = false; + let ret = false; let abiListInfo = deviceinfo.abiList; console.info('the value of the deviceinfo abiList is :' + abiListInfo); expect(abiListInfo).assertInstanceOf('String'); - if(abiListInfo !="" && abiListInfo != null && abiListInfo != undefined){ + if (abiListInfo != "" && abiListInfo != null && abiListInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetabiList01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0140 - * @tc.name testGetabiList01 - * @tc.desc Get the security patch level represented by a string. + * @tc.name testGetSecurityPatchTag01 + * @tc.desc Get the security patch level represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_013', 0, function () { console.info('testGetSecurityPatchTag01 start'); - let ret = false; + let ret = false; let securityPatchTagInfo = deviceinfo.securityPatchTag; console.info('the value of the deviceinfo securityPatchTag is :' + securityPatchTagInfo); expect(securityPatchTagInfo).assertInstanceOf('String'); - if(securityPatchTagInfo !="" && securityPatchTagInfo != null && securityPatchTagInfo != undefined){ + if (securityPatchTagInfo != "" && securityPatchTagInfo != null && securityPatchTagInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetSecurityPatchTag01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0150 - * @tc.name testGetabiList01 - * @tc.desc Get the version number visible to users represented by a string. + * @tc.name testGetDisplayVersion01 + * @tc.desc Get the product version represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_014', 0, function () { console.info('testGetDisplayVersion01 start'); - let ret = false; + let ret = false; let displayVersionInfo = deviceinfo.displayVersion; console.info('the value of the deviceinfo displayVersion is :' + displayVersionInfo); expect(displayVersionInfo).assertInstanceOf('String'); - if(displayVersionInfo !="" && displayVersionInfo != null && displayVersionInfo != undefined){ + if (displayVersionInfo != "" && displayVersionInfo != null && displayVersionInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetDisplayVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0160 * @tc.name testGetIncrementalVersion01 - * @tc.desc Get the difference version number represented by a string. + * @tc.desc Get the incremental version represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_015', 0, function () { console.info('testGetIncrementalVersion01 start'); - let ret = false; + let ret = false; let incrementalVersionInfo = deviceinfo.incrementalVersion; console.info('the value of the deviceinfo incrementalVersion is :' + incrementalVersionInfo); expect(incrementalVersionInfo).assertInstanceOf('String'); - if(incrementalVersionInfo !="" && incrementalVersionInfo != null && incrementalVersionInfo != undefined){ + if (incrementalVersionInfo != "" && incrementalVersionInfo != null && incrementalVersionInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetIncrementalVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0170 * @tc.name testGetOSReleaserType01 - * @tc.desc Get the OS release type. + * @tc.desc Get the OS release type represented by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_016', 0, function () { console.info('testGetOSReleaserType01 start'); - let ret = false; + let ret = false; let osReleaseTypeInfo = deviceinfo.osReleaseType; console.info('the value of the deviceinfo osReleaseType is :' + osReleaseTypeInfo); expect(osReleaseTypeInfo).assertInstanceOf('String'); - if(osReleaseTypeInfo !="" && osReleaseTypeInfo != null && osReleaseTypeInfo != undefined){ + if (osReleaseTypeInfo != "" && osReleaseTypeInfo != null && osReleaseTypeInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetOSReleaserType01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0180 * @tc.name testGetOSFullName01 - * @tc.desc Get the operating system full name. + * @tc.desc Get the operating system full name and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -408,274 +408,274 @@ describe('DeviceInfoTest', function () { console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo); expect(osFullNameInfo).assertInstanceOf('String'); - if(osFullNameInfo !="" && osFullNameInfo != null && osFullNameInfo != undefined){ + if (osFullNameInfo != "" && osFullNameInfo != null && osFullNameInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetOSFullName01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0190 * @tc.name testGetMajorVersion01 - * @tc.desc Get the major (M) version number, which increases with any updates to the overall architecture. + * @tc.desc Get the major (M) version number which the return value is greater than 0. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_018', 0, function () { console.info('testGetMajorVersion01 start'); - let ret = false; + let ret = false; let majorVersionInfo = deviceinfo.majorVersion; console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo); expect(majorVersionInfo).assertInstanceOf('Number'); - if(majorVersionInfo >= 0){ + if (majorVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetMajorVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0210 * @tc.name testGetSeniorVersion01 - * @tc.desc Get the senior (S) version number, which increases with any updates to the partial. + * @tc.desc Get the senior version number and the return value is greater than 0. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_019', 0, function () { console.info('testGetSeniorVersion01 start'); - let ret = false; + let ret = false; let seniorVersionInfo = deviceinfo.seniorVersion; console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo); expect(seniorVersionInfo).assertInstanceOf('Number'); - if(seniorVersionInfo >= 0){ + if (seniorVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetSeniorVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0220 * @tc.name testGetFeatureVersion01 - * @tc.desc Get the feature (F) version number, which increases with any planned new features. + * @tc.desc Get the feature (F) version number which the return value is greater than 0. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_020', 0, function () { console.info('testGetFeatureVersion01 start'); - let ret = false; + let ret = false; let featureVersionInfo = deviceinfo.featureVersion; console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo); expect(featureVersionInfo).assertInstanceOf('Number'); - if(featureVersionInfo >= 0){ + if (featureVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetFeatureVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0230 * @tc.name testGetBuildVersion01 - * @tc.desc Get the build (B) version number, which increases with each new development build. + * @tc.desc Get the build (B) version number which the return value is greater than 0. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_021', 0, function () { console.info('testGetBuildVersion01 start'); - let ret = false; + let ret = false; let buildVersionInfo = deviceinfo.buildVersion; console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo); expect(buildVersionInfo).assertInstanceOf('Number'); - if(buildVersionInfo >= 0){ + if (buildVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0240 * @tc.name testGetSdkApiVersion01 - * @tc.desc Get the API version number. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 + * @tc.desc Get the API version number, which return value type is number and return value is greater than 0. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 */ it('device_info_test_022', 0, function () { console.info('testGetSdkApiVersion01 start'); - let ret = false; + let ret = false; let sdkApiVersionInfo = deviceinfo.sdkApiVersion; console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo); expect(sdkApiVersionInfo).assertInstanceOf('Number'); - if(sdkApiVersionInfo >= 0){ + if (sdkApiVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetSdkApiVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0250 * @tc.name testGetFirstApiVersion01 - * @tc.desc Get the first API version number. + * @tc.desc Get the first API version number which the return value is greater than 0. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_023', 0, function () { console.info('testGetFirstApiVersion01 start'); - let ret = true; + let ret = true; let firstApiVersionInfo = deviceinfo.firstApiVersion; console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo); expect(firstApiVersionInfo).assertInstanceOf('Number'); - if(firstApiVersionInfo >= 0){ + if (firstApiVersionInfo >= 0) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetFirstApiVersion01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0260 * @tc.name testGetVersionId01 - * @tc.desc Get the version ID number. + * @tc.desc Get the version ID number by a string which the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_024', 0, function () { console.info('testGetVersionId01 start'); - let ret = false; + let ret = false; let versionIdInfo = deviceinfo.versionId; console.info('the value of the deviceinfo versionId is :' + versionIdInfo); expect(versionIdInfo).assertInstanceOf('String'); - if(versionIdInfo !="" && versionIdInfo != null && versionIdInfo != undefined){ + if (versionIdInfo != "" && versionIdInfo != null && versionIdInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetVersionId01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0270 * @tc.name testGetBuildType01 - * @tc.desc Get the different build types of the same baseline code. + * @tc.desc Get the different build types of the same baseline code which the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_025', 0, function () { console.info('testGetBuildType01 start'); - let ret = false; + let ret = false; let buildTypeInfo = deviceinfo.buildType; console.info('the value of the deviceinfo buildType is :' + buildTypeInfo); expect(buildTypeInfo).assertInstanceOf('String'); - if(buildTypeInfo !="" && buildTypeInfo != null && buildTypeInfo != undefined){ + if (buildTypeInfo != "" && buildTypeInfo != null && buildTypeInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildType01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0280 * @tc.name testGetBuildUser01 - * @tc.desc Get the different build user of the same baseline code. + * @tc.desc Get the different build user by a string which the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_026', 0, function () { console.info('testGetBuildUser01 start'); - let ret = true; + let ret = true; let buildUserInfo = deviceinfo.buildUser; console.info('the value of the deviceinfo buildUser is :' + buildUserInfo); expect(buildUserInfo).assertInstanceOf('String'); - if(buildUserInfo !="" && buildUserInfo != null && buildUserInfo != undefined){ + if (buildUserInfo != "" && buildUserInfo != null && buildUserInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildUser01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0290 - * @tc.name testGetBuildHost01 - * @tc.desc Get the different build host of the same baseline code. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 + * @tc.name testGetBuildHost01 + * @tc.desc Get the build host of the same baseline code by a string and the return value is not null. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 */ it('device_info_test_027', 0, function () { console.info('testGetBuildHost01 start'); - let ret = false; + let ret = false; let buildHostInfo = deviceinfo.buildHost; console.info('the value of the deviceinfo buildHost is :' + buildHostInfo); expect(buildHostInfo).assertInstanceOf('String'); - if(buildHostInfo !="" && buildHostInfo != null && buildHostInfo != undefined){ + if (buildHostInfo != "" && buildHostInfo != null && buildHostInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildHost01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0310 * @tc.name testGetBuildTime01 - * @tc.desc Get the the build time. + * @tc.desc Get the version build time by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_028', 0, function () { console.info('testGetBuildTime01 start'); - let ret = false; + let ret = false; let buildTimeInfo = deviceinfo.buildTime; console.info('the value of the deviceinfo buildTime is :' + buildTimeInfo); expect(buildTimeInfo).assertInstanceOf('String'); - if(buildTimeInfo !="" && buildTimeInfo != null && buildTimeInfo != undefined){ + if (buildTimeInfo != "" && buildTimeInfo != null && buildTimeInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildTime01 :end'); }) /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0320 * @tc.name testGetBuildRootHash01 - * @tc.desc Get the version hash. + * @tc.desc Get the version hash by a string and the return value is not null. * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('device_info_test_029', 0, function () { console.info('testGetBuildRootHash01 start'); - let ret = false; + let ret = false; let buildRootHashInfo = deviceinfo.buildRootHash; console.info('the value of the deviceinfo buildRootHash is :' + buildRootHashInfo); expect(buildRootHashInfo).assertInstanceOf('String'); - if(buildRootHashInfo !="" && buildRootHashInfo != null && buildRootHashInfo != undefined){ + if (buildRootHashInfo != "" && buildRootHashInfo != null && buildRootHashInfo != undefined) { ret = true; } - expect(ret).assertTrue(); + expect(ret).assertTrue(); console.info('testGetBuildRootHash01 :end'); }) @@ -693,7 +693,7 @@ describe('DeviceInfoTest', function () { console.info('the value of the deviceinfo deviceType is:' + deviceTypeInfo); let len = deviceTypeInfo.length - + console.info('the value of the device type characters:' + len); expect(len).assertLess(MAX_CHARACTERS_NUM_ONE) console.info('device_info_test_030 :end') @@ -720,7 +720,7 @@ describe('DeviceInfoTest', function () { /** * @tc.number SUB_STARTUP_JS_DEVCEINFO_0350 - * @tc.name testGetProductBrand02 + * @tc.name testGetDeviceBrand02 * @tc.desc Get a string representing the external product family name which has a maximum of 32 characters. * @tc.size : MEDIUM * @tc.type : Function @@ -1266,5 +1266,33 @@ describe('DeviceInfoTest', function () { expect(len).assertLarger(MAX_CHARACTERS_NUM); console.info('device_info_test_060 :end'); }) + + /** + * @tc.number SUB_STARTUP_JS_DEVCEINFO_0670 + * @tc.name testGetSecurityPatchTag02 + * @tc.desc Get security pactch tag which format is yy--mm--dd test. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('device_info_test_061', 0, function () { + console.info('testGetSecurityPatchTag02 start'); + let ret = false; + let securityPatchTagInfo = deviceinfo.securityPatchTag; + console.info('the value of the deviceinfo securityPatchTag is :' + securityPatchTagInfo); + + let reFormat = /^(\d{4})-(\d{2})-(\d{2})$/; + let re = securityPatchTagInfo.match(reFormat); + + if (re != null){ + ret = true; + expect(ret).assertTrue(); + }else{ + console.info('the return formate is not yy--mm--dd'); + } + + console.info('testGetSecurityPatchTag02 :end'); + }) }) + -- GitLab