【发布时间】:2019-04-29 09:45:10
【问题描述】:
在消费者层面的测试是:
describe('Listing first level taxonomies', () => {
before(() => {
return provider.addInteraction({
given: 'GET call for first level taxonomies',
uponReceiving: 'Get object for listing first level
taxonomies',
withRequest: {
method: 'GET',
path: '/api/taxonomies/8061159/taxons?deleted=false',
},
willRespondWith: {
status: 200,
headers: { 'Content-Type': 'application/json' },
body: firstChild
}
});
});
const firstChild = eachLike({
'name': like('Geo'),
'taxons': [
eachLike({
'id': like(115590),
'name': like('Africa'),
'hasChildren':like (false)
})
]
});
当我在提供者级别进行验证时,我收到以下错误: 期望一个数组但得到一个哈希 ({"name"=>"Demo Taxonomy", "taxons"=> [{"id"=>8145188, "name"=>"manojtaxon", "childCategoryName"=>"你好", “有孩子”=>真} 完全错误出现在: https://pastebin.com/XvB17SXY
请帮我解决问题 我认为数组大小更多的是在提供者级别,这就是它的原因 失败了。虽然我已经添加了like和eachLike(仍然没有 解决了)。
【问题讨论】:
标签: javascript arrays provider pact