diff --git a/src/gestalts/GestaltGraph.ts b/src/gestalts/GestaltGraph.ts index d44994865..3fba340da 100644 --- a/src/gestalts/GestaltGraph.ts +++ b/src/gestalts/GestaltGraph.ts @@ -1104,7 +1104,12 @@ class GestaltGraph { switch (type) { case 'node': { if ((await tran.get([...this.dbNodesPath, gestaltKey], true)) == null) { - throw new gestaltsErrors.ErrorGestaltsGraphNodeIdMissing(); + await this.setNode( + { + nodeId: id, + }, + tran, + ); } await this.acl.setNodeAction(id, action, tran); return; @@ -1498,6 +1503,7 @@ class GestaltGraph { return gestalt; } + // FIXME: this returns only 1 node that is linked to an identity, It should really return all of them. Maybe convert to a generator? protected async getIdentityLinkedNodeId( providerIdentityId: ProviderIdentityId, tran: DBTransaction, diff --git a/tests/client/handlers/gestalts.test.ts b/tests/client/handlers/gestalts.test.ts index c2d4311bd..b4cdc7f2f 100644 --- a/tests/client/handlers/gestalts.test.ts +++ b/tests/client/handlers/gestalts.test.ts @@ -1948,6 +1948,17 @@ describe('gestaltsGestaltTrustByNode', () => { notify: null, }); }); + test('trusts a node (not in gestalt graph)', async () => { + const request = { + nodeIdEncoded: nodeIdEncodedRemote, + }; + await rpcClient.methods.gestaltsGestaltTrustByNode(request); + expect( + await gestaltGraph.getGestaltActions(['node', nodeIdRemote!]), + ).toEqual({ + notify: null, + }); + }); test('trusts a node (new node)', async () => { const request = { nodeIdEncoded: nodeIdEncodedRemote, diff --git a/tests/client/handlers/vaults.test.ts b/tests/client/handlers/vaults.test.ts index af274acea..86e97efdc 100644 --- a/tests/client/handlers/vaults.test.ts +++ b/tests/client/handlers/vaults.test.ts @@ -468,9 +468,9 @@ describe('vaultsPermissionSet and vaultsPermissionUnset and vaultsPermissionGet' acl, logger, }); - await gestaltGraph.setNode({ - nodeId: nodeId, - }); + // Await gestaltGraph.setNode({ + // nodeId: nodeId, + // }); taskManager = await TaskManager.createTaskManager({ db, logger,