From 490f6acf9ca69dbe18ed5fbdde52b0a21a2385b2 Mon Sep 17 00:00:00 2001 From: hu-jixiang1 Date: Sun, 24 Apr 2022 11:08:56 +0800 Subject: [PATCH] fixed 758ad6a from https://gitee.com/hu-jixiang1/xts_acts/pulls/3036 enumTest Signed-off-by: hu-jixiang1 Change-Id: I60771025023203eaf69c04e40820ddc7228c197d --- .../entry/src/main/js/test/ListTest.js | 1 + .../entry/src/main/js/test/enumTest.js | 164 ++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js index 7664e9696..e8d02e111 100644 --- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js +++ b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js @@ -14,3 +14,4 @@ */ require('./execute.js') +require('./enumTest.js') diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js new file mode 100644 index 000000000..bdbd310fe --- /dev/null +++ b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import userAuth from '@ohos.userIAM.userAuth' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var index = require('../default/pages/index/index.js'); + +/** + * test case + */ +describe('userAuthTest', function () { + beforeEach(function(done) { + let waitTime = 1000; + setTimeout(function() { + done(); + }, waitTime); + }) + afterEach(function() { + }) + + /** + * @tc.name Enum AuthenticationResult.NO_SUPPORT test + * @tc.number JSAPI_Function_Enum_0100 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0100', 0, function () { + expect(typeof userAuth.AuthenticationResult.NO_SUPPORT !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.NO_SUPPORT).assertEqual(-1) + }) + + /** + * @tc.name Enum AuthenticationResult.SUCCESS test + * @tc.number JSAPI_Function_Enum_0200 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0200', 0, function () { + expect(typeof userAuth.AuthenticationResult.SUCCESS !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.SUCCESS).assertEqual(0) + }) + + /** + * @tc.name Enum AuthenticationResult.COMPARE_FAILURE test + * @tc.number JSAPI_Function_Enum_0300 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0300', 0, function () { + expect(typeof userAuth.AuthenticationResult.COMPARE_FAILURE !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.COMPARE_FAILURE).assertEqual(1) + }) + + /** + * @tc.name Enum AuthenticationResult.CANCELED test + * @tc.number JSAPI_Function_Enum_0400 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0400', 0, function () { + expect(typeof userAuth.AuthenticationResult.CANCELED !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.CANCELED).assertEqual(2) + }) + + /** + * @tc.name Enum AuthenticationResult.TIMEOUT test + * @tc.number JSAPI_Function_Enum_0500 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0500', 0, function () { + expect(typeof userAuth.AuthenticationResult.TIMEOUT !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.TIMEOUT).assertEqual(3) + }) + + /** + * @tc.name Enum AuthenticationResult.CAMERA_FAIL test + * @tc.number JSAPI_Function_Enum_0600 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0600', 0, function () { + expect(typeof userAuth.AuthenticationResult.CAMERA_FAIL !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.CAMERA_FAIL).assertEqual(4) + }) + + /** + * @tc.name Enum AuthenticationResult.BUSY test + * @tc.number JSAPI_Function_Enum_0700 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0700', 0, function () { + expect(typeof userAuth.AuthenticationResult.BUSY !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.BUSY).assertEqual(5) + }) + + /** + * @tc.name Enum AuthenticationResult.INVALID_PARAMETERS test + * @tc.number JSAPI_Function_Enum_0800 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0800', 0, function () { + expect(typeof userAuth.AuthenticationResult.INVALID_PARAMETERS !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.INVALID_PARAMETERS).assertEqual(6) + }) + + /** + * @tc.name Enum AuthenticationResult.LOCKED test + * @tc.number JSAPI_Function_Enum_0900 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_0900', 0, function () { + expect(typeof userAuth.AuthenticationResult.LOCKED !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.LOCKED).assertEqual(7) + }) + + /** + * @tc.name Enum AuthenticationResult.NOT_ENROLLED test + * @tc.number JSAPI_Function_Enum_1000 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_1000', 0, function () { + expect(typeof userAuth.AuthenticationResult.NOT_ENROLLED !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.NOT_ENROLLED).assertEqual(8) + }) + + /** + * @tc.name Enum AuthenticationResult.GENERAL_ERROR test + * @tc.number JSAPI_Function_Enum_1100 + * @tc.size MEDIUM + * @tc.type FUNC + * @tc.level Level2 + */ + it('JSAPI_Function_Enum_1100', 0, function () { + expect(typeof userAuth.AuthenticationResult.GENERAL_ERROR !==undefined).assertTrue() + expect(userAuth.AuthenticationResult.GENERAL_ERROR).assertEqual(100) + }) +}) \ No newline at end of file -- GitLab