| 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() { |