Adds an endpoint to check a rule manager rule from the rule manager against the specified copy.
The route is /api/rules/:id/test-block, and the document is specified in the body – here's an example:
{
"id": "id",
"blocks": [
{
"id": "elem-0",
"text": "The chancellor, [Jeremy Hunt](https://www.theguardian.com/politics/jeremy-hunt), said the best way to get growth going again was to ease pressure on households by bringing down inflation. “While an extra bank holiday had an impact on growth in May, high inflation remains a drag anchor on economic growth,” he said.",
"from": 0,
"to": 413
}
]
}
Dev notes
We stream matches directly from the checker.
We're using HMAC auth to make the request to the checker from the rule-manager.
How to test
The automated tests should pass, and you should be convinced they cover the testing method. We simulate a server in the tests to test the streaming behaviour, which makes them quite comprehensive.
Check content yourself locally! A GET request to https://manager.typerighter.local.dev-gutools.co.uk/api/rules/:id/test-block (be sure to add a valid cookie in the request) with the payload above should give a 200 response.
What does this change?
Adds an endpoint to check a rule manager rule from the rule manager against the specified copy.
The route is
/api/rules/:id/test-block
, and the document is specified in the body – here's an example:Dev notes
How to test
https://manager.typerighter.local.dev-gutools.co.uk/api/rules/:id/test-block
(be sure to add a valid cookie in the request) with the payload above should give a200
response.