Closed Meratyn closed 2 years ago
I tested the testing framework:
Modify spec/test/invalid/edge-1node.json:
{
"description": "An Edge cannot have only one node.",
"id": "edge1",
"node": [ "node1", "node2", "node3" ],
"errorInstancePath": "/node",
"errorMessage": "must NOT have fewer than 2 items"
}
Output of test.js referring to the test case:
Test /invalid/edge-1node.json:
/node must NOT have more than 2 items
Expected error: /node must NOT have fewer than 2 items
Yes, the test framework catches this case. However, for better usability, the error message could actually be improved. Example:
Test invalid/edge-1node.json:
Location: /node
Expected: must NOT have more than 2 items
Found : must NOT have fewer than 2 items
{
"description": "An Edge cannot have only one node.",
"id": "totallyInvalidId",
"node": [ "node1" ],
"errorInstancePath": "/node",
"errorMessage": "must NOT have fewer than 2 items"
}
Output of test.js referring to the test case:
Test /invalid/edge-1node.json:
/id must match pattern "^edge"
Expected error: /node must NOT have fewer than 2 items
Yes, the test framework catches this case.
I will do the rest of the proposals myself.
Fulfill #15 Expand invalid tests with a verification of expected failure. Invalid tests have two new fields: errorInstancePath and errorMessage. These contain the expected error instance path and message. test.js checks the validation errors against these fields for the invalid test cases.
Error messages for failed test shortened with redundant information removed.