UNPKG

machinepack-json

Version:
145 lines (144 loc) 2.46 kB
{ "machine": "parse", "expectations": [ { "using": { "json": "{\"foo\": \"blah\" , \"stuff\": \"whatever\"}", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "blah" } }, { "using": { "json": "{\"foo\": \"blah\"}", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "blah" } }, { "using": { "json": "{\"some_other_key\": \"blah\"}", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "" } }, { "using": { "json": "\"something else completely wrong\"", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "" } }, { "using": { "json": "23582385", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "" } }, { "using": { "json": "true", "schema": { "foo": "bar" } }, "outcome": "success", "returns": { "foo": "" } }, { "using": { "json": "something unparseable", "schema": { "foo": "bar" } }, "outcome": "couldNotParse" }, { "using": { "json": "[{\"stuff\": \"in here\"}]", "schema": [ "*" ] }, "outcome": "success", "returns": [ { "stuff": "in here" } ] }, { "using": { "json": "[{\"stuff\": \"in here\"}]", "schema": [] }, "outcome": "success", "returns": [ { "stuff": "in here" } ] }, { "using": { "json": "[{\"stuff\": \"in here\"}]", "schema": "*" }, "outcome": "success", "returns": [ { "stuff": "in here" } ] }, { "using": { "json": "[{\"stuff\": \"in here\"}]" }, "outcome": "success", "returns": [ { "stuff": "in here" } ] }, { "using": { "json": "\"hi\"", "schema": { "foo": "string" } }, "outcome": "success" } ] }