Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Oct 3, 2024
1 parent 133f805 commit 097de07
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/enr/src/enr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,17 @@ describe("ENR", function () {
});

describe("waku2 key round trip", () => {
let peerId;
let peerId: PeerId;
let enr: ENR;
let waku2Protocols: Waku2;
let privateKey: Uint8Array;
let privateKeyUint8Arr: Uint8Array;

beforeEach(async function () {
const privateKey = await generateKeyPair("secp256k1");
privateKeyUint8Arr = privateKey.raw;
peerId = peerIdFromPrivateKey(privateKey);
enr = await EnrCreator.fromPeerId(peerId);
console.log(enr);
waku2Protocols = {
relay: false,
store: false,
Expand All @@ -437,7 +439,7 @@ describe("ENR", function () {
it("should set field with all protocols disabled", async () => {
enr.waku2 = waku2Protocols;

const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(false);
Expand All @@ -453,7 +455,7 @@ describe("ENR", function () {
waku2Protocols.lightPush = true;

enr.waku2 = waku2Protocols;
const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(true);
Expand All @@ -466,7 +468,7 @@ describe("ENR", function () {
waku2Protocols.relay = true;

enr.waku2 = waku2Protocols;
const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(true);
Expand All @@ -479,7 +481,7 @@ describe("ENR", function () {
waku2Protocols.store = true;

enr.waku2 = waku2Protocols;
const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(false);
Expand All @@ -492,7 +494,7 @@ describe("ENR", function () {
waku2Protocols.filter = true;

enr.waku2 = waku2Protocols;
const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(false);
Expand All @@ -505,7 +507,7 @@ describe("ENR", function () {
waku2Protocols.lightPush = true;

enr.waku2 = waku2Protocols;
const txt = await EnrEncoder.toString(enr, privateKey);
const txt = await EnrEncoder.toString(enr, privateKeyUint8Arr);
const decoded = (await EnrDecoder.fromString(txt)).waku2!;

expect(decoded.relay).to.equal(false);
Expand Down

0 comments on commit 097de07

Please sign in to comment.