MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_json_array_single

Function test_json_array_single

src/environmentd/src/http/webhook.rs:543–570  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

541
542 #[mz_ore::test]
543 fn test_json_array_single() {
544 let single_raw = r#"
545 {
546 "event_type": "i am a single object",
547 "another_field": 42
548 }
549 "#;
550
551 // We should get a single Row regardless of whether or not we're requested to expand.
552 let rows = pack_rows(
553 single_raw.as_bytes(),
554 &WebhookBodyFormat::Json { array: false },
555 &BTreeMap::default(),
556 &WebhookHeaders::default(),
557 )
558 .unwrap();
559 assert_eq!(rows.len(), 1);
560
561 // We should get a single Row regardless of whether or not we're requested to expand.
562 let rows = pack_rows(
563 single_raw.as_bytes(),
564 &WebhookBodyFormat::Json { array: true },
565 &BTreeMap::default(),
566 &WebhookHeaders::default(),
567 )
568 .unwrap();
569 assert_eq!(rows.len(), 1);
570 }
571
572 #[mz_ore::test]
573 fn test_json_deserializer_multi() {

Callers

nothing calls this directly

Calls 3

pack_rowsFunction · 0.85
unwrapMethod · 0.80
as_bytesMethod · 0.45

Tested by

no test coverage detected