Payload Decoder, unit testing

Hi,
Implemented a payload decoder. Looking to test my payload decoder using a testing framework. Creating a testing file using Jest testing framework; for integrity checks.
On the payload decoder page you can manually input a single test case however I would like to automate this with lots of different test cases. As TTN is based on Node JS I’ve setup a Node JS local Environment.

I’m currently having an issue referencing input.bytes[0] through my testing framework.
What format should my data structures be to simulate payload ? In order reference the payload in the same way ttn passes the payload to the decoder.

Any support would be appreciated.
Thanks

It’s written in Go

The docs (linked bottom right of every console page) show the two part object of a byte array and the port number: Uplink | The Things Stack for LoRaWAN

Be careful when digging in to the detail of the PF - it’s vanilla JS, no imports, no XHR, run using a JavaScript ECMAScript 5.1 runtime. It will be terminated if it runs for more than 100ms.

If I am not mistaken, the TTN payload decoder API is compliant to the LoRaWAN alliance payload codec api:

2 Likes

Hi
Thanks for the response. I think misread this.
Payload Formatters | The Things Stack for LoRaWAN.

I will use the second link as a reference for my implementation. I will need to see if I can create Virtual environment only running ECMAScript5.1 js.

Thanks for the reference guide. If certifying your LoRaWAN end device. I’m assuming it needs to be compliant to this guide ?

The device doesn’t run JavaScript so not at all. The document is about how the payload could be decoded on the LNS - which isn’t hugely recommended, it’s a convenience function.

1 Like

No, it is a specification of the payload decoder in a LNS like TTN or Chirpstack

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.