test(router): capture graph, explain and OpenAPI goldens before indexing
graph(), explain() and openapi() read routePlans in declaration order. A
radix index must stay a lookup structure and never become their source, so
their output is frozen from ed47836 for CARD-09 to compare against.
One app fixture covers multiple methods and transports, constraints, explicit
HEAD and OPTIONS, providers and steps, and WS, declared out of specificity
order. The goldens hold graph(), explain() for declared patterns and the
`no route: <pattern>` error (including a concrete request path, which is not a
declaration), and openapi({ title: 'Parity', version: '1' }). A separate mesh
teacup records the pre-ready errors, then post-ready introspection in which
the remote HTTP route is reachable but absent from routePlans.
The comparison holds array order and object key order, and `vitest -u` is
refused rather than allowed to rewrite a golden.
Refs #109
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
5 files changed
+1051
No files matched your search
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"revision": "ed47836c9820c47bf4ed5e902d91e019abdb110a",
|
||||
"data": [
|
||||
{
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"explain": {
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
{
|
||||
"name": "get",
|
||||
"kind": "handler",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items",
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "no route: /api/items"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/live/:room",
|
||||
"explain": {
|
||||
"pattern": "/api/live/:room",
|
||||
"method": "GET",
|
||||
"transport": "ws",
|
||||
"chain": [
|
||||
{
|
||||
"name": "db",
|
||||
"kind": "provider",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"db"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"kind": "step",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [
|
||||
"db"
|
||||
],
|
||||
"provides": [
|
||||
"user"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "live",
|
||||
"kind": "handler",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [
|
||||
"user"
|
||||
],
|
||||
"provides": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:id/files/:path*",
|
||||
"explain": {
|
||||
"pattern": "/api/items/:id/files/:path*",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
{
|
||||
"name": "files",
|
||||
"kind": "handler",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/missing",
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "no route: /api/missing"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/42",
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "no route: /api/items/42"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/",
|
||||
"explain": {
|
||||
"pattern": "/api/items/",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
{
|
||||
"name": "db",
|
||||
"kind": "provider",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"db"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"kind": "step",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [
|
||||
"db"
|
||||
],
|
||||
"provides": [
|
||||
"user"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "list",
|
||||
"kind": "handler",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [
|
||||
"user"
|
||||
],
|
||||
"provides": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
{
|
||||
"revision": "ed47836c9820c47bf4ed5e902d91e019abdb110a",
|
||||
"data": {
|
||||
"nodes": [
|
||||
{
|
||||
"name": "db",
|
||||
"kind": "provider",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"db"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "logger",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"logger"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rooms",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"rooms"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "events",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"events"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"kind": "step",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [
|
||||
"db"
|
||||
],
|
||||
"provides": [
|
||||
"user"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "audit",
|
||||
"kind": "step",
|
||||
"origin": "module:IntrospectionModule",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"audit"
|
||||
]
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"pattern": "/api/items/:id/files/:path*",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"files"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"db",
|
||||
"user",
|
||||
"list"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/",
|
||||
"method": "POST",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"db",
|
||||
"user",
|
||||
"create"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"method": "HEAD",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"head"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"method": "OPTIONS",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"options"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:id(\\d+)",
|
||||
"method": "DELETE",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"audit",
|
||||
"remove"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/:slug([a-z0-9-]+)",
|
||||
"method": "PUT",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"upsert"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/items/search",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"search"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/events",
|
||||
"method": "GET",
|
||||
"transport": "sse",
|
||||
"chain": [
|
||||
"events"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/feed",
|
||||
"method": "GET",
|
||||
"transport": "negotiate",
|
||||
"chain": [
|
||||
"feed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/live/:room",
|
||||
"method": "GET",
|
||||
"transport": "ws",
|
||||
"chain": [
|
||||
"db",
|
||||
"user",
|
||||
"live"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
{
|
||||
"revision": "ed47836c9820c47bf4ed5e902d91e019abdb110a",
|
||||
"data": {
|
||||
"before": {
|
||||
"graph": {
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "graph() unavailable until a mesh app has booted: a mesh graph is not knowable until its teapots are asked. Call `await app.ready()` first — it is a no-op on a non-mesh app"
|
||||
}
|
||||
},
|
||||
"explain": {
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "explain() unavailable until a mesh app has booted: a mesh graph is not knowable until its teapots are asked. Call `await app.ready()` first — it is a no-op on a non-mesh app"
|
||||
}
|
||||
},
|
||||
"openapi": {
|
||||
"value": {
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Parity",
|
||||
"version": "1"
|
||||
},
|
||||
"paths": {
|
||||
"/api/local/who": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/local/{id}": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"graph": {
|
||||
"nodes": [
|
||||
{
|
||||
"name": "logger",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"logger"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rooms",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"rooms"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "events",
|
||||
"kind": "provider",
|
||||
"origin": "builtin",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"events"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"kind": "step",
|
||||
"origin": "mesh:<teapot>",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"config"
|
||||
]
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"pattern": "/api/local/who",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"config",
|
||||
"who"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pattern": "/api/local/:id",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
"byId"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"explain": [
|
||||
{
|
||||
"pattern": "/api/missing",
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "no route: /api/missing"
|
||||
}
|
||||
}
|
||||
],
|
||||
"explainLocal": {
|
||||
"pattern": "/api/local/who",
|
||||
"method": "GET",
|
||||
"transport": "buffer",
|
||||
"chain": [
|
||||
{
|
||||
"name": "config",
|
||||
"kind": "step",
|
||||
"origin": "mesh:<teapot>",
|
||||
"needs": [],
|
||||
"provides": [
|
||||
"config"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "who",
|
||||
"kind": "handler",
|
||||
"origin": "module:TeacupModule",
|
||||
"needs": [
|
||||
"config"
|
||||
],
|
||||
"provides": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"explainRemote": {
|
||||
"error": {
|
||||
"name": "Error",
|
||||
"message": "no route: /api/remote/ping"
|
||||
}
|
||||
},
|
||||
"openapi": {
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Parity",
|
||||
"version": "1"
|
||||
},
|
||||
"paths": {
|
||||
"/api/local/who": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/local/{id}": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lookup": {
|
||||
"path": "/api/remote/ping",
|
||||
"status": 200,
|
||||
"body": "{\"from\":\"teapot\"}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
{
|
||||
"revision": "ed47836c9820c47bf4ed5e902d91e019abdb110a",
|
||||
"data": {
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Parity",
|
||||
"version": "1"
|
||||
},
|
||||
"paths": {
|
||||
"/api/items/{id}/files/{path}": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/items": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/items/{id}": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "\\d+"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "expand",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"head": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "\\d+"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "\\d+"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"delete": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "\\d+"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/items/{slug}": {
|
||||
"put": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation failed"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "slug",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "[a-z0-9-]+"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/items/search": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/events": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Event stream",
|
||||
"content": {
|
||||
"text/event-stream": {}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/feed": {
|
||||
"get": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Stream",
|
||||
"content": {
|
||||
"application/x-ndjson": {}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user