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

Function test_plugin

chirpstack/src/adr/plugin.rs:155–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153
154 #[tokio::test]
155 async fn test_plugin() {
156 let p = Plugin::new("../examples/adr_plugins/plugin_skeleton.js").unwrap();
157
158 assert_eq!("Example plugin", p.get_name());
159 assert_eq!("example_id", p.get_id());
160
161 let req = Request {
162 region_config_id: "eu868".into(),
163 region_common_name: lrwn::region::CommonName::EU868,
164 dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
165 mac_version: lrwn::region::MacVersion::LORAWAN_1_0_3,
166 reg_params_revision: lrwn::region::Revision::A,
167 adr: true,
168 dr: 3,
169 tx_power_index: 0,
170 nb_trans: 1,
171 max_tx_power_index: 15,
172 required_snr_for_dr: -15.0,
173 installation_margin: 10.0,
174 min_dr: 0,
175 max_dr: 5,
176 uplink_history: vec![],
177 skip_f_cnt_check: false,
178 device_variables: Default::default(),
179 };
180
181 let resp = p.handle(&req).await.unwrap();
182 assert_eq!(
183 Response {
184 dr: 3,
185 tx_power_index: 0,
186 nb_trans: 1,
187 },
188 resp
189 );
190 }
191}

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.80
intoMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected