Skip to content

Commit

Permalink
add test for FOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykirby committed May 20, 2018
1 parent e3e18b1 commit b38b341
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "lora-packet",
"version": "0.7.5",
"version": "0.7.6",
"author": "Anthony Kirby",
"description": "LoRa packet decoder/encoder",
"keywords": [
Expand Down
30 changes: 30 additions & 0 deletions test/test_fopts.js
@@ -0,0 +1,30 @@
'use strict';

var lora_packet = require('..');
var expect = require("chai").expect;
var assert = require('chai').assert;

module.exports = function () {

// TODO more variation on this

describe('parse packets from github issue #18', function () {
it('should parse packet #1', function () {

var message_hex = "4084412505A3010009110308B33750F504D4B86A";
// console.log ("packet #1 message_hex = "+new Buffer(message_base64, 'base64').toString("hex"));

var parsed = lora_packet.fromWire(new Buffer(message_hex, 'hex'));

expect(parsed).to.not.be.undefined;
expect(parsed.getBuffers()).to.not.be.undefined;
expect(parsed.getBuffers().FOpts).to.not.be.undefined;
expect(parsed.getBuffers().FOpts).to.deep.equal(new Buffer('091103', 'hex'));

// var asString = parsed.toString();
// console.log(asString);
});


});
};
1 change: 1 addition & 0 deletions test/unittest.js
Expand Up @@ -7,4 +7,5 @@ describe("unit tests", function () {
require('./test_decrypt.js')();
require('./test_keygen.js')();
require('./test_github_issue17.js')();
require('./test_fopts.js')();
});

0 comments on commit b38b341

Please sign in to comment.