| 364 | |
| 365 | #[tokio::test] |
| 366 | pub async fn test_encode_error() { |
| 367 | let encoder = r#" |
| 368 | function encodeDownlink(input) { |
| 369 | return foo; |
| 370 | } |
| 371 | "# |
| 372 | .to_string(); |
| 373 | |
| 374 | let vars: HashMap<String, String> = HashMap::new(); |
| 375 | |
| 376 | let input = prost_types::Struct { |
| 377 | ..Default::default() |
| 378 | }; |
| 379 | |
| 380 | let out = encode(10, &vars, &encoder, &input).await; |
| 381 | assert_eq!( |
| 382 | "JS error: Error: foo is not defined\n at encodeDownlink (main:5:1)\n at <anonymous> (main:10:39)\n", |
| 383 | out.err().unwrap().to_string() |
| 384 | ); |
| 385 | } |
| 386 | |
| 387 | #[tokio::test] |
| 388 | pub async fn test_encode() { |