1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include "interface_js_napi_test.h"
16 #include "string_util.h"
17 using namespace testing::ext;
18 using namespace OHOS::HiviewDFX;
19 
SetUp()20 void InterfaceJsNapiTest::SetUp()
21 {
22     /**
23      * @tc.setup: create an event loop and multiple event handlers
24      */
25     printf("SetUp.\n");
26 }
27 
TearDown()28 void InterfaceJsNapiTest::TearDown()
29 {
30     /**
31      * @tc.teardown: destroy the event loop we have created
32      */
33     printf("TearDown.\n");
34 }
35 
36 /**
37  * @tc.name: HideSnInfo001
38  * @tc.desc: hide the sn in the file
39  * @tc.type: FUNC
40  */
41 HWTEST_F(InterfaceJsNapiTest, HideSnInfo001, TestSize.Level3)
42 {
43     /**
44      * @tc.steps: step1. hide sn for full file name
45      */
46     const std::string fullFileName =
47     "AAA-BBBB-CCC-DDD 0.0.0.0EE(FFFFFFFFFFFFFF)_01234567$AAAAAAAAAaaaaaa+BBBBBBBBBbbbbbbbbb=_123456789123456_A.zip";
48     std::string hideSnFileName = StringUtil::HideSnInfo(fullFileName);
49 
50     const std::string expectFileName =
51     "AAA-BBBB-CCC-DDD 0.0.0.0EE(FFFFFFFFFFFFFF)_******_123456789123456_A.zip";
52     EXPECT_EQ(hideSnFileName, expectFileName);
53 }