Initial update for the bitmessage-js package #1

Merged
PeterSurda merged 15 commits from lee.miller/bitmessage-js:mac into master 2024-03-08 01:55:30 +01:00
Showing only changes of commit 67712c69fa - Show all commits

14
test.js
View File

@ -296,7 +296,7 @@ describe("Common structures", function() {
res = var_int.decode(Buffer.from("7b", "hex"));
expect(res.value).to.equal(123);
expect(res.length).to.equal(1);
expect(res.rest.toString("hex")).to.equal("")
expect(res.rest.toString("hex")).to.equal("");
res = var_int.decode(Buffer.from("fd123456", "hex"));
expect(res.value).to.equal(0x1234);
@ -410,7 +410,7 @@ describe("Common structures", function() {
expect(res.port).to.equal(8444);
expect(net_addr.decode.bind(null, Buffer.from(
"000000000000000100000000000000000000ffff7f00000120fc", "hex"))).to.throw(Error);;
"000000000000000100000000000000000000ffff7f00000120fc", "hex"))).to.throw(Error);
res = net_addr.decode(Buffer.from("000000000000000100000000000000000000ffff7f00000120fc", "hex"), {short: true});
expect(res.services.get(ServicesBitfield.NODE_NETWORK)).to.be.true;
@ -793,7 +793,7 @@ describe("Object types", function() {
ttl: 100,
to: "2cTux3PGRqHTEH6wyUP2sWeT4LrsGgy63z",
}).then(function(payload) {
expect(POW.check({ttl: 100, payload: payload})).to.be.true;;
expect(POW.check({ttl: 100, payload: payload})).to.be.true;
return getpubkey.decodePayloadAsync(payload);
}).then(function(res) {
expect(res.ttl).to.be.at.most(100);
@ -877,7 +877,7 @@ describe("Object types", function() {
this.timeout(300000);
return pubkey.encodePayloadAsync({ttl: 789, from: from, to: from})
.then(function(payload) {
expect(POW.check({ttl: 789, payload: payload})).to.be.true;;
expect(POW.check({ttl: 789, payload: payload})).to.be.true;
return pubkey.decodePayloadAsync(payload, {needed: from});
}).then(function(res) {
expect(res.ttl).to.be.at.most(789);
@ -1001,7 +1001,7 @@ describe("Object types", function() {
to: from,
message: "test",
}).then(function(payload) {
expect(POW.check({ttl: 111, payload: payload})).to.be.true;;
expect(POW.check({ttl: 111, payload: payload})).to.be.true;
return msg.decodePayloadAsync(payload, {identities: from});
}).then(function(res) {
expect(res.ttl).to.be.at.most(111);
@ -1131,7 +1131,7 @@ describe("Object types", function() {
from: from,
message: "test",
}).then(function(payload) {
expect(POW.check({ttl: 101, payload: payload})).to.be.true;;
expect(POW.check({ttl: 101, payload: payload})).to.be.true;
return broadcast.decodePayloadAsync(payload, {subscriptions: from});
}).then(function(res) {
expect(res.ttl).to.be.at.most(101);
@ -1412,7 +1412,7 @@ describe("High-level classes", function() {
});
it("should encode bitmessage's user agent", function() {
var res = UserAgent.decode(UserAgent.encodeSelf())
var res = UserAgent.decode(UserAgent.encodeSelf());
var software = UserAgent.parse(res.str);
expect(software[0].name).to.equal("bitmessage");
expect(software[0]).to.have.property("version");