MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_encode_error

Function test_encode_error

chirpstack/src/codec/js/mod.rs:366–385  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

to_stringMethod · 0.80
encodeFunction · 0.70

Tested by

no test coverage detected