例如,我收到这样的回复:
{
"name": "David",
"age": 45,
"company": [
{
"name": "G00g1e",
"id": 253674,
"employee": [
{
"name": "Frank",
"age": 20
},
{
"name": "Jason",
"age": 21
}
]
},
{
"name": "F4ceb00k",
"id": 937394,
"employee": [
{
"name": "James",
"age": 20
},
{
"name": "Zuck",
"age": 23
}
]
}
]
}
这是frisby expectJSONTypes 语句:
// assertion success
.expectJSONTypes({
name: String,
age: Number,
company: Array
})
// assertion success
.expectJSONTypes('company.*', {
name: String,
id: Number,
employee: Array
})
// TypeError: Expected 'company.employee.*' to be Array (got 'undefined' from JSON response)
.expectJSONTypes('company.employee.*', {
name: String,
age: Number
})
根据我的理解,这样表达嵌套数组似乎是正确的,但实际上它不起作用。如何修改第三条 expectJSONTypes 语句来正确表达这种情况?
提前致谢!