From 86e7a46e289ee176fcfa6827827302510434ffb5 Mon Sep 17 00:00:00 2001 From: Felipe Forbeck Date: Mon, 14 Oct 2024 15:05:32 -0300 Subject: [PATCH] fix(test): await promise and check error (#1563) **Resolve ESLint Promise Handling Error** Fixed the ESLint error by using `assert.rejects` to handle the promise returned by `deviceCheater.setCurrentSpace`. This ensures that the promise is properly managed and the test checks for expected rejections, addressing the ESLint rule that requires promises to be awaited, handled with `.catch`, or explicitly ignored. --- packages/upload-api/test/access-client-agent.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/upload-api/test/access-client-agent.js b/packages/upload-api/test/access-client-agent.js index a97ade0aa..c6ded27e1 100644 --- a/packages/upload-api/test/access-client-agent.js +++ b/packages/upload-api/test/access-client-agent.js @@ -380,7 +380,10 @@ export const test = { ) // deviceCheater shouldn't have access to the space - deviceCheater.setCurrentSpace(space.did()) + await assert.rejects(deviceCheater.setCurrentSpace(space.did()), { + name: 'Error', + message: `Agent has no proofs for ${space.did()}.`, + }) // deviceCheater tries to craft a delegation to gain access to the account const unattestedDelegation = await Top.top.delegate({