Files
BACKBEAT/contracts/tests/examples/beatframe-invalid.json
2025-10-17 08:56:25 +11:00

152 lines
4.5 KiB
JSON

[
{
"description": "Missing required field 'beat_index'",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"downbeat": false,
"phase": "execute",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["beat_index is required"]
},
{
"description": "Invalid phase value",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "invalid_phase",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["phase must be one of: plan, execute, review"]
},
{
"description": "Invalid HLC format (wrong number of segments)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["hlc must match pattern ^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$"]
},
{
"description": "Invalid HLC format (non-hex characters)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "gggg:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["hlc must match pattern ^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$"]
},
{
"description": "Invalid window_id format (too short)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d"
},
"expected_errors": ["window_id must be exactly 32 hex characters"]
},
{
"description": "Invalid tempo_bpm (too low)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 0.05,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["tempo_bpm must be at least 0.1"]
},
{
"description": "Invalid tempo_bpm (too high)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 1001.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["tempo_bpm must be at most 1000"]
},
{
"description": "Invalid beat_index (negative)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": -1,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["beat_index must be >= 0"]
},
{
"description": "Wrong message type",
"message": {
"type": "backbeat.wrongtype.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5"
},
"expected_errors": ["type must be 'backbeat.beatframe.v1'"]
},
{
"description": "Extra unknown properties (should fail with additionalProperties: false)",
"message": {
"type": "backbeat.beatframe.v1",
"cluster_id": "test",
"beat_index": 0,
"downbeat": false,
"phase": "plan",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:00:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5",
"unknown_field": "should not be allowed"
},
"expected_errors": ["Additional property unknown_field is not allowed"]
}
]