|
1 | | -import { METADATA_MAP, TORUS_LEGACY_NETWORK, TORUS_NETWORK_TYPE, TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants"; |
| 1 | +import { METADATA_MAP, SIG_TYPE, TORUS_LEGACY_NETWORK, TORUS_NETWORK_TYPE, TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants"; |
2 | 2 | import { getSapphireNodeDetails } from "@toruslabs/fnd-base"; |
3 | | -import { deepStrictEqual, strictEqual, throws } from "assert"; |
| 3 | +import { deepStrictEqual, rejects, strictEqual, throws } from "assert"; |
4 | 4 |
|
5 | 5 | import NodeDetailManager from "../src/nodeDetailManager"; |
6 | 6 |
|
@@ -115,6 +115,27 @@ describe("Fetch Node Details", function () { |
115 | 115 | ); |
116 | 116 | }); |
117 | 117 |
|
| 118 | + it("#should throw error for invalid key type and sig type", async function () { |
| 119 | + const nodeDetailManager = new NodeDetailManager({ |
| 120 | + network: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET, |
| 121 | + fndServerEndpoint, |
| 122 | + enableLogging: true, |
| 123 | + }); |
| 124 | + |
| 125 | + const sigType = SIG_TYPE.ED25519; |
| 126 | + |
| 127 | + await rejects( |
| 128 | + async () => { |
| 129 | + await nodeDetailManager.getNodeDetails({ verifier: "google", verifierId: "hello@tor.us", keyType: "secp256k1", sigType }); |
| 130 | + }, |
| 131 | + (err) => { |
| 132 | + const error = err as Error; |
| 133 | + strictEqual(error.message, `Invalid key type for ${sigType}`); |
| 134 | + return true; |
| 135 | + } |
| 136 | + ); |
| 137 | + }); |
| 138 | + |
118 | 139 | it("#should use default network if not provided", async function () { |
119 | 140 | const nodeDetailManager = new NodeDetailManager({ |
120 | 141 | fndServerEndpoint, |
|
0 commit comments