Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshuchawla009 committed Feb 7, 2025
1 parent 5a96dee commit eeb9e66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,11 @@ export async function retrieveOrImportShare(params: {

const promiseArrRequest = [];

// if dkg is not used, we need to get existing key or import new shares from client
const getExistingKeyOrImportNewShares = !useDkg;
// if dkg is not used and may be its not a existing key,
// we need to get existing key or import new shares from client
const getExistingKeyOrImportNewShares = !useDkg && !isExistingKey;
if (overrideExistingKey) {
// import new key flow
isImportingShares = true;
const proxyEndpointNum = getProxyCoordinatorEndpointIndex(endpoints, verifier, verifierParams.verifier_id);
const items: Record<string, unknown>[] = [];
Expand Down Expand Up @@ -503,6 +505,7 @@ export async function retrieveOrImportShare(params: {
).catch((err) => log.error("share req", err));
promiseArrRequest.push(p);
} else if (getExistingKeyOrImportNewShares) {
// no dkg login and registration flow
const proxyEndpointNum = getProxyCoordinatorEndpointIndex(endpoints, verifier, verifierParams.verifier_id);
const items: Record<string, unknown>[] = [];
for (let i = 0; i < endpoints.length; i += 1) {
Expand Down Expand Up @@ -547,6 +550,7 @@ export async function retrieveOrImportShare(params: {
).catch((err) => log.error("share req", err));
promiseArrRequest.push(p);
} else {
// dkg login and registration flow
for (let i = 0; i < endpoints.length; i += 1) {
const p = post<JRPCResponse<ShareRequestResult>>(
endpoints[i],
Expand Down
2 changes: 1 addition & 1 deletion test/onekey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe("torus onekey", function () {
expect(publicAddress.oAuthKeyData.walletAddress).to.not.equal(null);
});

it("should be able to key assign via login", async function () {
it.only("should be able to key assign via login", async function () {
const email = faker.internet.email();
const token = generateIdToken(email, "ES256");
const verifierDetails = { verifier: TORUS_TEST_VERIFIER, verifierId: email };
Expand Down
2 changes: 1 addition & 1 deletion test/sapphire_devnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe("torus utils sapphire devnet", function () {
token,
nodeDetails.torusNodePub,
{},
true,
false,
false
)
);
Expand Down

0 comments on commit eeb9e66

Please sign in to comment.