chaik
v0.0.4
Published
can be used in unittest to compare json data format or to check existance in db
Downloads
4
Maintainers
Readme
to verify a json object's structure
emtpy object
- chaik.structure({},[])
no nested field
- chaik.structure({a:1},["a"])
nested field
- chaik.structure({ a: 1, b: { c: 2 } },["a", { b: ["c"] }])
object array
- chaik.structure([{ a: 1 }],[["a"]])
optional field
- chaik.structure({},["*a"])
- chaik.structure({ a: 1 },["*a"])
- chaik.structure({ a: 1 },["*a"])
- chaik.structure({ a: 1, b: { c: 2 } },["*a", { "*b": ["c"] }])
array field
- chaik.structure({ a: { b: [1, 2, 3] }, { "a": { "b": [] } })
to verify data existance in db
init
pass in a standard knex connection config
chaik.initDbConnection(config)
to verify existance
- chaik.in.database(objToVerify, tableName, searchCondition)
- chaik.in.database(objectArrayToVerify, tableName, searchCondition)
ensure inexistance
- chaik.notIn.database(tableName, searchCondition)