Skip to content

Commit 422b9c0

Browse files
bartlomiejuclaude
andcommitted
fix: correct test assertion for missing id field
crdtp Dispatchable requires an integer id property for all messages (MESSAGE_MUST_HAVE_INTEGER_ID_PROPERTY). A message without id is not ok(), not a valid notification as previously assumed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9387241 commit 422b9c0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/test_api.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12919,13 +12919,11 @@ fn crdtp_dispatchable_missing_fields() {
1291912919
// crdtp considers missing method as ok=false
1292012920
assert!(!dispatchable.ok());
1292112921

12922-
// Missing "id" field — valid for notifications
12922+
// Missing "id" field — crdtp requires an integer id for all dispatchables
1292312923
let json = r#"{"method":"Test.event","params":{}}"#;
1292412924
let cbor = v8::crdtp::json_to_cbor(json.as_bytes()).unwrap();
1292512925
let dispatchable = v8::crdtp::Dispatchable::new(&cbor);
12926-
assert!(dispatchable.ok());
12927-
assert!(!dispatchable.has_call_id());
12928-
assert_eq!(dispatchable.method_str(), "Test.event");
12926+
assert!(!dispatchable.ok());
1292912927
}
1293012928

1293112929
#[test]

0 commit comments

Comments
 (0)