mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 00:33:12 +00:00
revert change that is just noise
This commit is contained in:
parent
1bbb129d04
commit
8d278f8132
@ -24,8 +24,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
createTestMetaSetter,
|
createTestMetaSetter,
|
||||||
createTestRLNCodecSetup,
|
createTestRLNCodecSetup,
|
||||||
EmptyProtoMessage,
|
EMPTY_PROTO_MESSAGE,
|
||||||
TestConstants,
|
TEST_CONSTANTS,
|
||||||
verifyRLNMessage
|
verifyRLNMessage
|
||||||
} from "./codec.test-utils.js";
|
} from "./codec.test-utils.js";
|
||||||
import { RlnMessage } from "./message.js";
|
import { RlnMessage } from "./message.js";
|
||||||
@ -38,8 +38,8 @@ describe("RLN codec with version 0", () => {
|
|||||||
|
|
||||||
const rlnEncoder = createRLNEncoder({
|
const rlnEncoder = createRLNEncoder({
|
||||||
encoder: createEncoder({
|
encoder: createEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo
|
routingInfo: TEST_CONSTANTS.routingInfo
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
index,
|
index,
|
||||||
@ -48,8 +48,8 @@ describe("RLN codec with version 0", () => {
|
|||||||
const rlnDecoder = createRLNDecoder({
|
const rlnDecoder = createRLNDecoder({
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
decoder: createDecoder(
|
decoder: createDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo
|
TEST_CONSTANTS.routingInfo
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ describe("RLN codec with version 0", () => {
|
|||||||
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
||||||
expect(protoResult).to.not.be.undefined;
|
expect(protoResult).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toProtoObj", async function () {
|
it("toProtoObj", async function () {
|
||||||
@ -72,8 +72,8 @@ describe("RLN codec with version 0", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createEncoder({
|
createEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo
|
routingInfo: TEST_CONSTANTS.routingInfo
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
index,
|
index,
|
||||||
@ -81,18 +81,18 @@ describe("RLN codec with version 0", () => {
|
|||||||
);
|
);
|
||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createDecoder(TestConstants.contentTopic, TestConstants.routingInfo)
|
createDecoder(TEST_CONSTANTS.contentTopic, TEST_CONSTANTS.routingInfo)
|
||||||
);
|
);
|
||||||
|
|
||||||
const proto = await rlnEncoder.toProtoObj({ payload });
|
const proto = await rlnEncoder.toProtoObj({ payload });
|
||||||
|
|
||||||
expect(proto).to.not.be.undefined;
|
expect(proto).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
proto!
|
proto!
|
||||||
)) as RlnMessage<IDecodedMessage>;
|
)) as RlnMessage<IDecodedMessage>;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createSymEncoder({
|
createSymEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
symKey
|
symKey
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -115,8 +115,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createSymDecoder(
|
createSymDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo,
|
TEST_CONSTANTS.routingInfo,
|
||||||
symKey
|
symKey
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -127,11 +127,11 @@ describe("RLN codec with version 1", () => {
|
|||||||
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
||||||
expect(protoResult).to.not.be.undefined;
|
expect(protoResult).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Symmetric, toProtoObj", async function () {
|
it("Symmetric, toProtoObj", async function () {
|
||||||
@ -141,8 +141,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createSymEncoder({
|
createSymEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
symKey
|
symKey
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -152,8 +152,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createSymDecoder(
|
createSymDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo,
|
TEST_CONSTANTS.routingInfo,
|
||||||
symKey
|
symKey
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -162,11 +162,11 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
expect(proto).to.not.be.undefined;
|
expect(proto).to.not.be.undefined;
|
||||||
const msg = await rlnDecoder.fromProtoObj(
|
const msg = await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
proto!
|
proto!
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Asymmetric, toWire", async function () {
|
it("Asymmetric, toWire", async function () {
|
||||||
@ -177,8 +177,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createAsymEncoder({
|
createAsymEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
publicKey
|
publicKey
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -188,8 +188,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createAsymDecoder(
|
createAsymDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo,
|
TEST_CONSTANTS.routingInfo,
|
||||||
privateKey
|
privateKey
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -200,11 +200,11 @@ describe("RLN codec with version 1", () => {
|
|||||||
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
||||||
expect(protoResult).to.not.be.undefined;
|
expect(protoResult).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Asymmetric, toProtoObj", async function () {
|
it("Asymmetric, toProtoObj", async function () {
|
||||||
@ -215,8 +215,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createAsymEncoder({
|
createAsymEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
publicKey
|
publicKey
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -226,8 +226,8 @@ describe("RLN codec with version 1", () => {
|
|||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createAsymDecoder(
|
createAsymDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo,
|
TEST_CONSTANTS.routingInfo,
|
||||||
privateKey
|
privateKey
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -236,11 +236,11 @@ describe("RLN codec with version 1", () => {
|
|||||||
|
|
||||||
expect(proto).to.not.be.undefined;
|
expect(proto).to.not.be.undefined;
|
||||||
const msg = await rlnDecoder.fromProtoObj(
|
const msg = await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
proto!
|
proto!
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -251,8 +251,8 @@ describe("RLN Codec - epoch", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createEncoder({
|
createEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo
|
routingInfo: TEST_CONSTANTS.routingInfo
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
index,
|
index,
|
||||||
@ -260,14 +260,14 @@ describe("RLN Codec - epoch", () => {
|
|||||||
);
|
);
|
||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createDecoder(TestConstants.contentTopic, TestConstants.routingInfo)
|
createDecoder(TEST_CONSTANTS.contentTopic, TEST_CONSTANTS.routingInfo)
|
||||||
);
|
);
|
||||||
|
|
||||||
const proto = await rlnEncoder.toProtoObj({ payload });
|
const proto = await rlnEncoder.toProtoObj({ payload });
|
||||||
|
|
||||||
expect(proto).to.not.be.undefined;
|
expect(proto).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
proto!
|
proto!
|
||||||
)) as RlnMessage<IDecodedMessage>;
|
)) as RlnMessage<IDecodedMessage>;
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ describe("RLN Codec - epoch", () => {
|
|||||||
expect(msg.epoch!.toString(10).length).to.eq(9);
|
expect(msg.epoch!.toString(10).length).to.eq(9);
|
||||||
expect(msg.epoch).to.eq(epoch);
|
expect(msg.epoch).to.eq(epoch);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
|
|
||||||
const rlnEncoder = createRLNEncoder({
|
const rlnEncoder = createRLNEncoder({
|
||||||
encoder: createEncoder({
|
encoder: createEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
metaSetter
|
metaSetter
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -300,8 +300,8 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
const rlnDecoder = createRLNDecoder({
|
const rlnDecoder = createRLNDecoder({
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
decoder: createDecoder(
|
decoder: createDecoder(
|
||||||
TestConstants.contentTopic,
|
TEST_CONSTANTS.contentTopic,
|
||||||
TestConstants.routingInfo
|
TEST_CONSTANTS.routingInfo
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -311,17 +311,17 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
const protoResult = await rlnDecoder.fromWireToProtoObj(bytes!);
|
||||||
expect(protoResult).to.not.be.undefined;
|
expect(protoResult).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
const expectedMeta = metaSetter({
|
const expectedMeta = metaSetter({
|
||||||
...EmptyProtoMessage,
|
...EMPTY_PROTO_MESSAGE,
|
||||||
payload: protoResult!.payload
|
payload: protoResult!.payload
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(msg!.meta).to.deep.eq(expectedMeta);
|
expect(msg!.meta).to.deep.eq(expectedMeta);
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toProtoObj", async function () {
|
it("toProtoObj", async function () {
|
||||||
@ -331,8 +331,8 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
|
|
||||||
const rlnEncoder = new RLNEncoder(
|
const rlnEncoder = new RLNEncoder(
|
||||||
createEncoder({
|
createEncoder({
|
||||||
contentTopic: TestConstants.contentTopic,
|
contentTopic: TEST_CONSTANTS.contentTopic,
|
||||||
routingInfo: TestConstants.routingInfo,
|
routingInfo: TEST_CONSTANTS.routingInfo,
|
||||||
metaSetter
|
metaSetter
|
||||||
}),
|
}),
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
@ -341,23 +341,23 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
);
|
);
|
||||||
const rlnDecoder = new RLNDecoder(
|
const rlnDecoder = new RLNDecoder(
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
createDecoder(TestConstants.contentTopic, TestConstants.routingInfo)
|
createDecoder(TEST_CONSTANTS.contentTopic, TEST_CONSTANTS.routingInfo)
|
||||||
);
|
);
|
||||||
|
|
||||||
const proto = await rlnEncoder.toProtoObj({ payload });
|
const proto = await rlnEncoder.toProtoObj({ payload });
|
||||||
|
|
||||||
expect(proto).to.not.be.undefined;
|
expect(proto).to.not.be.undefined;
|
||||||
const msg = (await rlnDecoder.fromProtoObj(
|
const msg = (await rlnDecoder.fromProtoObj(
|
||||||
TestConstants.emptyPubsubTopic,
|
TEST_CONSTANTS.emptyPubsubTopic,
|
||||||
proto!
|
proto!
|
||||||
)) as RlnMessage<IDecodedMessage>;
|
)) as RlnMessage<IDecodedMessage>;
|
||||||
|
|
||||||
const expectedMeta = metaSetter({
|
const expectedMeta = metaSetter({
|
||||||
...EmptyProtoMessage,
|
...EMPTY_PROTO_MESSAGE,
|
||||||
payload: msg!.payload
|
payload: msg!.payload
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(msg!.meta).to.deep.eq(expectedMeta);
|
expect(msg!.meta).to.deep.eq(expectedMeta);
|
||||||
verifyRLNMessage(msg, payload, TestConstants.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export interface TestRLNCodecSetup {
|
|||||||
payload: Uint8Array;
|
payload: Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TestConstants = {
|
export const TEST_CONSTANTS = {
|
||||||
contentTopic: "/test/1/waku-message/utf8",
|
contentTopic: "/test/1/waku-message/utf8",
|
||||||
emptyPubsubTopic: "",
|
emptyPubsubTopic: "",
|
||||||
defaultIndex: 0,
|
defaultIndex: 0,
|
||||||
@ -26,7 +26,7 @@ export const TestConstants = {
|
|||||||
)
|
)
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const EmptyProtoMessage = {
|
export const EMPTY_PROTO_MESSAGE = {
|
||||||
timestamp: undefined,
|
timestamp: undefined,
|
||||||
contentTopic: "",
|
contentTopic: "",
|
||||||
ephemeral: undefined,
|
ephemeral: undefined,
|
||||||
@ -46,8 +46,8 @@ export async function createTestRLNCodecSetup(): Promise<TestRLNCodecSetup> {
|
|||||||
return {
|
return {
|
||||||
rlnInstance,
|
rlnInstance,
|
||||||
credential,
|
credential,
|
||||||
index: TestConstants.defaultIndex,
|
index: TEST_CONSTANTS.defaultIndex,
|
||||||
payload: TestConstants.defaultPayload
|
payload: TEST_CONSTANTS.defaultPayload
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user