add full ut

Signed-off-by: s00912778 <shijiakai2@huawei.com>
Change-Id: I35bc664267e28aa60f313e70fee260534901b653
This commit is contained in:
s00912778 2024-10-22 17:10:35 +08:00
parent a4e3242ae8
commit 16337b633c
5 changed files with 134 additions and 28 deletions

View File

@ -105,7 +105,10 @@
"message": "The property 'message' must specify a type.",
"type": "ERROR"
},
"validateNonObservedClassType": [],
"validateNonObservedClassType": {
"message": "The type of the @ObjectLink property 'message' can only be objects of classes decorated with @Observed class decorator in ets (not ts).",
"type": "ERROR"
},
"validateHasIllegalDecoratorInEntry": {
"message": "The @Entry component 'ValidateHasIllegalDecoratorInEntryIndex' cannot have the @Prop property 'message'.",
"type": "WARN"
@ -135,7 +138,7 @@
"type": "ERROR"
},
"checkBuilder$$": {
"message": "The regular property 'paramA1' cannot be assigned to the @Link property 'message'.",
"message": "Unrecognized property 'paramA1', make sure it can be assigned to @Link property 'message' by yourself.",
"type": "WARN"
},
"validateForbiddenToInitViaParam": {
@ -554,11 +557,50 @@
"type": "ERROR"
}
],
"v2DecoratorInitFromParent": {
"message": "Property 'param_value' must be initialized through the component constructor.",
"type": "ERROR"
},
"validateParamTwoWayBind": [],
"v2DecoratorInitFromParent": [
{
"message": "Property 'param_value' must be initialized through the component constructor.",
"type": "ERROR"
},
{
"message": "Property 'regular_value' in the custom component 'testChild' cannot be initialized here (forbidden to specify).",
"type": "ERROR"
},
{
"message": "Property 'local_value' in the custom component 'testChild' cannot be initialized here (forbidden to specify).",
"type": "ERROR"
},
{
"message": "Property 'provider_value' in the custom component 'testChild' cannot be initialized here (forbidden to specify).",
"type": "ERROR"
},
{
"message": "Property 'consumer_value' in the custom component 'testChild' cannot be initialized here (forbidden to specify).",
"type": "ERROR"
}
],
"validateParamTwoWayBind": [
{
"message": "When the two-way binding syntax is used, the variable 'value' must be decorated with @Param, and the @Event variable '$value' must be defined in the testParamChild1.",
"type": "ERROR"
},
{
"message": "The optional character can not be used in the initial value of property 'paramValue'.",
"type": "ERROR"
},
{
"message": "The optional character can not be used in the initial value of property 'paramValue'.",
"type": "ERROR"
},
{
"message": "When the two-way binding syntax is used, the initial value of property 'paramValue' must be a variable.",
"type": "ERROR"
},
{
"message": "When the two-way binding syntax is used, the initial value of property 'paramValue' must be a variable.",
"type": "ERROR"
}
],
"validateDifferentMethod": [
{
"message": "A function can only be decorated by one of the 'AnimatableExtend, Builder, Extend, Styles, Concurrent and Sendable'.",
@ -713,14 +755,67 @@
"type": "ERROR"
}
],
"v1ToV2Component": [],
"v1ToV2Component": [
{
"message": "Property 'func_value1' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'func_value2' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
"v1ToV2ComponentValidate": [
{
"message": "The type of the @Param property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Prop property 'prop_value' can only be string, number or boolean.",
"message": "Property 'param_value' in the @ComponentV2 component 'TestV2Child2' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'param_value_alias_type' in the @ComponentV2 component 'TestV2Child2' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'state_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'provide_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'consume_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'objectLink_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'storage_link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'storage_prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'local_storage_link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'local_storage_prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
@ -734,11 +829,11 @@
"type": "ERROR"
},
{
"message": "The type of the @Prop property 'regular_value' can only be string, number or boolean.",
"message": "Property 'set_value' in the @Component component 'TestV1Child1' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "The type of the @Prop property 'func_value1' can only be string, number or boolean.",
"message": "Property 'set_value_alias' in the @Component component 'TestV1Child1' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
@ -746,7 +841,27 @@
"type": "ERROR"
},
{
"message": "The type of the @Prop property 'map_value' can only be string, number or boolean.",
"message": "Property 'set_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'map_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value1' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value2' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value3' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
@ -850,10 +965,6 @@
{
"message": "The type of the @Consumer property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Prop property 'prop_value' can only be string, number or boolean.",
"type": "ERROR"
}
]
}

View File

@ -19,7 +19,7 @@ enum MemberType {
class TestObserved {
}
type newType = Set<number> | Set<string>
type DummyNewType = Set<number> | Set<string>
@ComponentV2
struct TestV2Parent1 {
string_value: string = "hello"
@ -32,7 +32,7 @@ struct TestV2Parent1 {
@Event func_value2: () => void = () => {}
@Local set_value: Set<number> | Set<string> = new Set<number>()
@Local set_value_alias: newType = new Set<string>()
@Local set_value_alias: DummyNewType = new Set<string>()
build() {
Column() {
TestV1Child1({
@ -59,7 +59,7 @@ struct TestV1Child1 {
@Link enum_value1: MemberType
@Link enum_value: Set<number> | MemberType
@Provide set_value: Set<number> | Set<string> = new Set<string>()
@State set_value_alias: newType = new Set<string>()
@State set_value_alias: DummyNewType = new Set<string>()
@ObjectLink objectLink_value: TestObserved
@Prop func_value1: Function
@BuilderParam func_value2: () => void

View File

@ -56,7 +56,7 @@ const OUTPUTS_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/
const MAIN_PAGES: string[] = UT_PAGES.map((p) => `pages/ut/${p}`);
mocha.describe('test UT testcases [non-preview mode]', function () {
this.timeout(7500);
this.timeout(10000);
mocha.before(function () {
resetUtils();
@ -137,15 +137,9 @@ mocha.describe('test UT testcases [non-preview mode]', function () {
const transform = this.etsTransformPlugin.transform.bind(this.rollup);
// expect(sourceCode !== null).to.be.true;
// done();
transform(sourceReplace(sourceCode), sourceFilePath)
.then(res => {
// console.error(`1-${index}: result: `, res.code);
expect(parseCode(res.code)).eql(parseCode(targetCode));
// expect(res !== null).to.be.true;
done();
})
.catch(err => done(err));

View File

@ -56,7 +56,7 @@ const OUTPUTS_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/
const MAIN_PAGES: string[] = UT_PARTIAL_UPFATE_PAGES.map((p) => `pages/utForPartialUpdate/${p}`);
mocha.describe('test UT for partial update testcases [non-preview mode]', function () {
this.timeout(7500);
this.timeout(10000);
mocha.before(function () {
resetUtils();

View File

@ -57,7 +57,7 @@ const ERROR_COLLECTION_PATH: string = path.resolve(__dirname, '../../test/error.
const MAIN_PAGES: string[] = UT_VALIDATE_PAGES.map((p) => `pages/utForValidate/${p}`);
mocha.describe('test UT for validate testcases [non-preview mode]', function () {
this.timeout(7500);
this.timeout(10000);
mocha.before(function () {
resetUtils();
@ -82,6 +82,7 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
Object.assign(projectConfig, this.globalProjectConfig);
this.globalPartialUpdateConfig = new PartialUpdateConfig();
this.globalPartialUpdateConfig.setPartialUpdateMode(true);
this.globalPartialUpdateConfig.mockDisableArkTSLinter();
Object.assign(partialUpdateConfig, this.globalPartialUpdateConfig);