vlucas / frisby

Frisby is a REST API testing framework built on Jest that makes testing API endpoints easy, fast, and fun.

Home Page:http://frisbyjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonTypes false positive with array path and extra keys

prabhash-c opened this issue · comments

frisby.fromJSON({"data": [{"user": "tom"},{"user": "jack"}]}) .expect('jsonTypes', 'data.*', {user: Joi.string(), hack: Joi.number()})

This should fail, but it doesn't.

If hack is required, do the following:

frisby.fromJSON({
  "data": [
    {"user": "tom"},
    {"user": "jack"}
  ]
})
  .expect('jsonTypes', 'data.*', {
    user: Joi.string(),
    hack: Joi.number().required(),
  })

https://hapi.dev/module/joi/api/#anyrequired---aliases-exist