json - 如何为 json 模式编写测试?
问题描述
我已经使用 JSON 模式创建了我的 UI,我很困惑如何为它编写测试?我在网上查看了各种资源,但不知道如何开始。我想测试一下,如果单选按钮为真,那么下拉菜单会显示,并且下拉菜单中还有输入字段。这是我的代码,我想使用 javascript 或酶对其进行测试:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
},
"type": "object",
"properties": {
"enabled": {
"title": "click me to enable this radiobutton",
"type": "boolean",
"default": false
}
},
"dependencies": {
"enabled": {
"oneOf": [
{
"properties": {
"enabled": {
"enum": [
false
]
}
}
},
{
"properties": {
"enabled": {
"enum": [
true
]
},
"style": {
"title": "Color Type",
"enum": [
"rainbow",
"primaryColors",
"mixedColors"
],
"enumNames": [
"Rainbow",
"Primary",
"Mixed"
],
"default": "primaryColors"
}
},
"dependencies": {
"style": {
"oneOf": [
{
"properties": {
"style": {
"enum": [
"rainbow"
]
},
"violet": {
"title": "Violet",
"type": "string"
}
}
},
{
"properties": {
"style": {
"enum": [
"primaryColors"
]
},
"red": {
"title": "this is red",
"type": "string"
}
}
},
{
"properties": {
"style": {
"enum": [
"mixedColors"
]
},
"pink": {
"title": "I am pink",
"type": "string"
}
}
}
]
}
}
}
]
}
}
}
解决方案
推荐阅读
- java - hive 2.3.9 无法使用 JDBC Uri 打开客户端传输:jdbc:hive2://localhost:10000/default: java.net.ConnectException: Connection denied
- typescript - 从不同文件导入多个同名模块
- extjs - Extjs 用于可视化图表数据的问题,该图表从控制器中的存储集加载它们
- linux - 无法在linux中连接cloudflare warp vpn
- java - 从 Spring Bean xml 到 Spring Bean Java 类
- azure-devops - Azure Pipelines:多行参数
- oauth-2.0 - 使用 getaadtoken() 生成令牌时出错
- c# - 使用派生类时,.NET 5 (Newtonsoft) 中的 Json 反序列化失败
- ios - iOS Swift 5 中的基本身份验证
- android - FAILURE:构建失败并出现异常(flutter build apk)