link-endpoints
Tests one part of the structure checks.
Our implementation passes this case when its check --json output for the input below equals the expected
output.
Input
nodes/draft-plane.md---
id: draft-plane
type: plane
fields: { order: 1, scratch: true }
---nodes/lt-any.md---
id: lt-any
type: link-type
fields: { name: relates, from: [], to: [] }
---nodes/lt-owns.md---
id: lt-owns
type: link-type
fields: { name: owns, from: [team], to: [service, store] }
---nodes/store-a.md---
id: store-a
type: store
---nodes/svc-a.md---
id: svc-a
type: service
links:
- { type: owns, to: store-a }
- { type: owns, to: ghost-node }
---nodes/svc-draft.md---
id: svc-draft
type: service
plane: draft-plane
links:
- { type: owns, to: svc-draft }
---nodes/team-a.md---
id: team-a
type: team
links:
- { type: owns, to: svc-a }
- { type: owns, to: store-a }
- { type: owns, to: team-b }
- { type: relates, to: team-b }
---nodes/team-b.md---
id: team-b
type: team
---Expected output
0 ghosts · 0 load errors · 8 nodes · 0 results
expected.json{
"ghosts": [],
"load_errors": [],
"nodes": [
{
"body": "",
"fields": {
"order": 1,
"scratch": true
},
"id": "draft-plane",
"links": [],
"parent": null,
"plane": null,
"title": "draft-plane",
"type": "plane"
},
{
"body": "",
"fields": {
"from": [],
"name": "relates",
"to": []
},
"id": "lt-any",
"links": [],
"parent": null,
"plane": null,
"title": "lt-any",
"type": "link-type"
},
{
"body": "",
"fields": {
"from": [
"team"
],
"name": "owns",
"to": [
"service",
"store"
]
},
"id": "lt-owns",
"links": [],
"parent": null,
"plane": null,
"title": "lt-owns",
"type": "link-type"
},
{
"body": "",
"fields": {},
"id": "store-a",
"links": [],
"parent": null,
"plane": null,
"title": "store-a",
"type": "store"
},
{
"body": "",
"fields": {},
"id": "svc-a",
"links": [
{
"to": "store-a",
"type": "owns"
},
{
"to": "ghost-node",
"type": "owns"
}
],
"parent": null,
"plane": null,
"title": "svc-a",
"type": "service"
},
{
"body": "",
"fields": {},
"id": "svc-draft",
"links": [
{
"to": "svc-draft",
"type": "owns"
}
],
"parent": null,
"plane": "draft-plane",
"title": "svc-draft",
"type": "service"
},
{
"body": "",
"fields": {},
"id": "team-a",
"links": [
{
"to": "svc-a",
"type": "owns"
},
{
"to": "store-a",
"type": "owns"
},
{
"to": "team-b",
"type": "owns"
},
{
"to": "team-b",
"type": "relates"
}
],
"parent": null,
"plane": null,
"title": "team-a",
"type": "team"
},
{
"body": "",
"fields": {},
"id": "team-b",
"links": [],
"parent": null,
"plane": null,
"title": "team-b",
"type": "team"
}
],
"results": [],
"structure": {
"errors": [
{
"kind": "missing_link_target",
"node": "svc-a",
"ref": "owns->ghost-node"
}
],
"warnings": [
{
"kind": "link_endpoint_mismatch",
"node": "svc-a",
"ref": "owns->store-a"
},
{
"kind": "link_endpoint_mismatch",
"node": "team-a",
"ref": "owns->team-b"
}
]
}
}