chore: add autosharding test vectors

This commit is contained in:
Arseniy Klempner 2024-02-05 06:52:30 -08:00
parent 1ffa5db7e7
commit 7e88d3b565
No known key found for this signature in database
GPG Key ID: 59967D458EFBF01B
1 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,9 @@ describe("ensureValidContentTopic", () => {
"/1/myapp/1/mytopic/cbor", "/1/myapp/1/mytopic/cbor",
"/2/myapp/1/mytopic/cbor", "/2/myapp/1/mytopic/cbor",
"/3/myapp/1/mytopic/cbor", "/3/myapp/1/mytopic/cbor",
"/1000/myapp/1/mytopic/cbor" "/1000/myapp/1/mytopic/cbor",
"/1/toychat/2/huilong/proto",
"/1/statusim/1/community/cbor"
], ],
"Generation greater than 0 is not supported" "Generation greater than 0 is not supported"
); );
@ -97,7 +99,11 @@ describe("contentTopicToShardIndex", () => {
const contentTopics: [string, number][] = [ const contentTopics: [string, number][] = [
["/toychat/2/huilong/proto", 3], ["/toychat/2/huilong/proto", 3],
["/myapp/1/latest/proto", 0], ["/myapp/1/latest/proto", 0],
["/waku/2/content/test.js", 1] ["/waku/2/content/test.js", 1],
["/toychat/2/huilong/proto", 3],
["/0/toychat/2/huilong/proto", 3],
["/statusim/1/community/cbor", 4],
["/0/statusim/1/community/cbor", 4]
]; ];
for (const [topic, shard] of contentTopics) { for (const [topic, shard] of contentTopics) {
expect(contentTopicToShardIndex(topic)).to.eq(shard); expect(contentTopicToShardIndex(topic)).to.eq(shard);