-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add SDK function for creating node from application and version
- Loading branch information
1 parent
5e1bce4
commit f8b8df8
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createApplicationNode, WakuNode } from "@waku/sdk"; | ||
import { | ||
contentTopicToPubsubTopic, | ||
ensureValidContentTopic | ||
} from "@waku/utils"; | ||
import { expect } from "chai"; | ||
|
||
describe("SDK: Creating by Application and Version", function () { | ||
const ContentTopic = "/myapp/1/latest/proto"; | ||
|
||
it("given an application and version, creates a waku node with the correct pubsub topic", async function () { | ||
const contentTopic = ensureValidContentTopic(ContentTopic); | ||
const waku = await createApplicationNode( | ||
contentTopic.application, | ||
contentTopic.version | ||
); | ||
const expectedPubsubTopic = contentTopicToPubsubTopic(ContentTopic); | ||
|
||
expect((waku as WakuNode).pubsubTopics).to.include(expectedPubsubTopic); | ||
}); | ||
}); |