diff --git a/bindings/wasm/cypress/integration/browser_test.js b/bindings/wasm/cypress/integration/browser_test.js index f4e1d899aa..6e38f7db65 100644 --- a/bindings/wasm/cypress/integration/browser_test.js +++ b/bindings/wasm/cypress/integration/browser_test.js @@ -7,6 +7,7 @@ import { createVP } from "../../examples/browser/create_vp.js"; import { createDiff } from "../../examples/browser/diff_chain.js"; import { revoke } from "../../examples/browser/revoke_vc.js"; import { merkleKey } from "../../examples/browser/merkle_key.js"; +import { createIdentityPrivateTangle } from "../../examples/browser/private_tangle"; import { resolveHistory } from "../../examples/browser/resolve_history"; // Test that the browser examples do not throw uncaught exceptions twice, including syntax errors etc. @@ -83,6 +84,18 @@ describe( await merkleKey(defaultClientConfig(), false); } }); + + it("private tangle", async function () { + try { + await createIdentityPrivateTangle(false, false) + throw new Error("Did not throw.") + } catch (err) { + // Example is expected to throw an error because no private Tangle is running + expect(err.name).to.eq("ClientError") + expect(err.message).to.contain("error sending request") + } + }); + it("diff chain", async function () { try { await createDiff(defaultClientConfig(), false); @@ -90,6 +103,7 @@ describe( await createDiff(defaultClientConfig(), false); } }); + it("resolve history", async function () { try { await resolveHistory(defaultClientConfig(), false); diff --git a/bindings/wasm/examples/README.md b/bindings/wasm/examples/README.md index ac371fe81a..26a0fc585c 100644 --- a/bindings/wasm/examples/README.md +++ b/bindings/wasm/examples/README.md @@ -43,7 +43,7 @@ The following examples are currently available: | 7 | [revoke_vc](node/revoke_vc.js) | Remove a verification method from the Issuers DID Document, making the Verifiable Credential it signed unable to verify, effectively revoking the VC. | | 8 | [resolution](node/resolution.js) | Resolves an existing DID to return the latest DID Document. | | 9 | [merkle_key](node/merkle_key.js) | Adds a MerkleKeyCollection verification method to an Issuers DID Document and signs a Verifiable Credential with the key on index 0. Afterwards the key on index 0 is deactivated, making the Verifiable Credential fail its verification. | - +| 10 | [private_tangle](node/private_tangle.js) | Showcases the same procedure as `create_did`, but on a private tangle - a locally running hornet node. | ### Browser Examples diff --git a/bindings/wasm/examples/browser/index.html b/bindings/wasm/examples/browser/index.html index 749b344226..87d110d2f9 100644 --- a/bindings/wasm/examples/browser/index.html +++ b/bindings/wasm/examples/browser/index.html @@ -47,6 +47,12 @@ +
+ + + +
+ @@ -55,7 +61,6 @@ Resolve History -