mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-14 14:03:11 +00:00
23 lines
613 B
TypeScript
23 lines
613 B
TypeScript
|
|
import { createDecoder, createEncoder, Decoder, Encoder } from "@waku/core";
|
||
|
|
|
||
|
|
// Utility to generate test data for multiple topics tests.
|
||
|
|
export function generateTestData(topicCount: number): {
|
||
|
|
contentTopics: string[];
|
||
|
|
encoders: Encoder[];
|
||
|
|
decoders: Decoder[];
|
||
|
|
} {
|
||
|
|
const contentTopics = Array.from(
|
||
|
|
{ length: topicCount },
|
||
|
|
(_, i) => `/test/${i + 1}/waku-multi`
|
||
|
|
);
|
||
|
|
const encoders = contentTopics.map((topic) =>
|
||
|
|
createEncoder({ contentTopic: topic })
|
||
|
|
);
|
||
|
|
const decoders = contentTopics.map((topic) => createDecoder(topic));
|
||
|
|
return {
|
||
|
|
contentTopics,
|
||
|
|
encoders,
|
||
|
|
decoders
|
||
|
|
};
|
||
|
|
}
|