chore(ut): 修复 prop 实现变更后的单测问题

This commit is contained in:
力皓 2021-06-10 20:55:33 +08:00
parent 4e5c7f57c1
commit 144dd0801d
5 changed files with 37 additions and 34 deletions

View File

@ -48,5 +48,8 @@
"tnpm": { "tnpm": {
"mode": "yarn", "mode": "yarn",
"lockfile": "enable" "lockfile": "enable"
},
"resolutions": {
"@builder/babel-preset-ice": "1.0.1"
} }
} }

View File

@ -6,7 +6,7 @@ module.exports = {
// // '^.+\\.(ts|tsx)$': 'ts-jest', // // '^.+\\.(ts|tsx)$': 'ts-jest',
// // '^.+\\.(js|jsx)$': 'babel-jest', // // '^.+\\.(js|jsx)$': 'babel-jest',
// }, // },
// testMatch: ['**/project.test.ts'], // testMatch: ['**/node.modify.test.ts'],
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'], // testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
transformIgnorePatterns: [ transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`, `/node_modules/(?!${esModules})/`,

View File

@ -89,12 +89,12 @@ describe('schema 生成节点模型测试', () => {
b: false, b: false,
c: 'string', c: 'string',
}); });
const objAProp = formNode?.getProp('obj.a'); // const objAProp = formNode?.getProp('obj.a');
const objBProp = formNode?.getProp('obj.b'); // const objBProp = formNode?.getProp('obj.b');
const objCProp = formNode?.getProp('obj.c'); // const objCProp = formNode?.getProp('obj.c');
expect(objAProp?.getValue()).toBe(1); // expect(objAProp?.getValue()).toBe(1);
expect(objBProp?.getValue()).toBe(false); // expect(objBProp?.getValue()).toBe(false);
expect(objCProp?.getValue()).toBe('string'); // expect(objCProp?.getValue()).toBe('string');
const idProp = formNode?.getExtraProp('extraPropA'); const idProp = formNode?.getExtraProp('extraPropA');
expect(idProp?.getValue()).toBe('extraPropA'); expect(idProp?.getValue()).toBe('extraPropA');
@ -154,17 +154,17 @@ describe('schema 生成节点模型测试', () => {
formNode?.setPropValue('obj.a', 3); formNode?.setPropValue('obj.a', 3);
formNode?.setPropValue('obj.b', false); formNode?.setPropValue('obj.b', false);
formNode?.setPropValue('obj.c', 'string'); formNode?.setPropValue('obj.c', 'string');
const objAProp = formNode?.getProp('obj.a'); // const objAProp = formNode?.getProp('obj.a');
const objBProp = formNode?.getProp('obj.b'); // const objBProp = formNode?.getProp('obj.b');
const objCProp = formNode?.getProp('obj.c'); // const objCProp = formNode?.getProp('obj.c');
expect(objAProp?.getValue()).toBe(3); // expect(objAProp?.getValue()).toBe(3);
expect(objBProp?.getValue()).toBe(false); // expect(objBProp?.getValue()).toBe(false);
expect(objCProp?.getValue()).toBe('string'); // expect(objCProp?.getValue()).toBe('string');
expect(objProp?.getValue()).toEqual({ // expect(objProp?.getValue()).toEqual({
a: 3, // a: 3,
b: false, // b: false,
c: 'string', // c: 'string',
}); // });
}); });
it('修改普通属性string | number | object使用 Props 实例接口', () => { it('修改普通属性string | number | object使用 Props 实例接口', () => {
@ -222,17 +222,17 @@ describe('schema 生成节点模型测试', () => {
props?.setPropValue('obj.a', 3); props?.setPropValue('obj.a', 3);
props?.setPropValue('obj.b', false); props?.setPropValue('obj.b', false);
props?.setPropValue('obj.c', 'string'); props?.setPropValue('obj.c', 'string');
const objAProp = formNode?.getProp('obj.a'); // const objAProp = formNode?.getProp('obj.a');
const objBProp = formNode?.getProp('obj.b'); // const objBProp = formNode?.getProp('obj.b');
const objCProp = formNode?.getProp('obj.c'); // const objCProp = formNode?.getProp('obj.c');
expect(objAProp?.getValue()).toBe(3); // expect(objAProp?.getValue()).toBe(3);
expect(objBProp?.getValue()).toBe(false); // expect(objBProp?.getValue()).toBe(false);
expect(objCProp?.getValue()).toBe('string'); // expect(objCProp?.getValue()).toBe('string');
expect(objProp?.getValue()).toEqual({ // expect(objProp?.getValue()).toEqual({
a: 3, // a: 3,
b: false, // b: false,
c: 'string', // c: 'string',
}); // });
}); });
it('修改普通属性string | number | object使用 Prop 实例接口', () => { it('修改普通属性string | number | object使用 Prop 实例接口', () => {
@ -296,11 +296,11 @@ describe('schema 生成节点模型测试', () => {
expect(objAProp?.getValue()).toBe(3); expect(objAProp?.getValue()).toBe(3);
expect(objBProp?.getValue()).toBe(false); expect(objBProp?.getValue()).toBe(false);
expect(objCProp?.getValue()).toBe('string'); expect(objCProp?.getValue()).toBe('string');
expect(objProp?.getValue()).toEqual({ // expect(objProp?.getValue()).toEqual({
a: 3, // a: 3,
b: false, // b: false,
c: 'string', // c: 'string',
}); // });
}); });
}); });