-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(formily-schema,zod): 💅 refactor zod, formily-schema by TypeR…
…esolver and teset update by snapshots
- Loading branch information
Showing
13 changed files
with
455 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Bun Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`removeEmptyComments 应该移除空注释 / should remove empty comments from the input string 1`] = `"another comment"`; | ||
|
||
exports[`removeEmptyComments 当没有空注释时应返回原字符串 / should return the original string if no empty comments are present 1`] = `"another comment"`; | ||
|
||
exports[`removeEmptyComments 应该移除多行注释中的空行 / should remove empty lines in multi-line comments 1`] = ` | ||
"这是一段描述 | ||
another comment" | ||
`; | ||
|
||
exports[`removeEmptyComments 应该移除单行注释 / should remove single line comments 1`] = `"这是一个注释"`; | ||
|
||
exports[`removeEmptyComments 应该处理没有注释的情况 / should handle cases with no comments 1`] = `""`; | ||
|
||
exports[`parseAndRemoveAnnotations 应该解析注解并从输入字符串中移除它们 / should parse annotations and remove them from the input string 1`] = ` | ||
{ | ||
"cleaned": "some text", | ||
"parsed": { | ||
"flag": true, | ||
"title": "Example", | ||
}, | ||
} | ||
`; | ||
|
||
exports[`parseAndRemoveAnnotations 当没有注解时应返回空的解析对象和清理后的字符串 / should return empty parsed object and cleaned string if no annotations are present 1`] = ` | ||
{ | ||
"cleaned": "some text without annotations", | ||
"parsed": {}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
packages/formily-schema/__tests__/__snapshots__/index.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// Bun Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`formily schema tests 应该正确转换用户信息模式 / should transform user information schema correctly 1`] = ` | ||
"import { ISchema } from "@formily/json-schema"; | ||
const Form: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"user": User | ||
} | ||
}; | ||
const User: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"title": "用户名", | ||
"type": "string" | ||
}, | ||
"address": Address, | ||
"addressList": { | ||
"description": "地址列表", | ||
"type": "array", | ||
"x-component": "ArrayTable", | ||
"items": { | ||
"type": "void", | ||
"x-component": "ArrayTable.Item", | ||
"properties": "#Address" | ||
} | ||
} | ||
} | ||
}; | ||
const Address: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"city": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"title": "城市", | ||
"enum": [ | ||
{ | ||
"label": "北京", | ||
"value": "北京" | ||
}, | ||
{ | ||
"label": "上海", | ||
"value": "上海" | ||
} | ||
] | ||
}, | ||
"street": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"title": "街道", | ||
"type": "string" | ||
} | ||
} | ||
}; | ||
" | ||
`; | ||
|
||
exports[`formily schema tests 应该处理循环引用 / should handle circular references 1`] = ` | ||
"import { ISchema } from "@formily/json-schema"; | ||
const Form: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"a": A | ||
} | ||
}; | ||
const A: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"b": B | ||
} | ||
}; | ||
const B: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"a": A | ||
} | ||
}; | ||
" | ||
`; | ||
|
||
exports[`formily schema tests 应该正确转换基本类型 / should transform basic types correctly 1`] = ` | ||
"import { ISchema } from "@formily/json-schema"; | ||
const Form: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"basicTypes": BasicTypes | ||
} | ||
}; | ||
const BasicTypes: ISchema = { | ||
"type": "object", | ||
"properties": { | ||
"str": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"type": "string" | ||
}, | ||
"num": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"type": "number" | ||
}, | ||
"bool": { | ||
"x-decorator": "FormItem", | ||
"x-component": "Input", | ||
"type": "boolean" | ||
} | ||
} | ||
}; | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.