magiclabs / magic-admin-js

Magic admin Node.js SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
https://docs.magic.link/admin-sdk/node-js
MIT License
76 stars 33 forks source link

How to mock @magic-sdk/admin in NodeJS or enable Test Mode in Magic Admin SDK? #103

Closed jesuslopezlugo closed 1 year ago

jesuslopezlugo commented 1 year ago

✅ Prerequisites

❓ Question

How to mock @magic-sdk/admin in NodeJS or enable Test Mode in Magic Admin SDK?

I'm trying to mock @magic-sdk/admin using sinon.js without success.

Do you have test mode for admin sdk like you have for client sdk?

In order to create valid test did token and make unit testing with my code

🌎 Environment

Software Version(s)
@magic-sdk/admin 1.8.0
Node 16.19.0
npm 8.19.3
Operating System Mac OS
ayv8er commented 1 year ago

@jesuslopezlugo We don't have a testMode configuration available for the admin SDK. The token resolved from a client SDK configured to testMode will have limited abilities in the admin SDK. You can see the expected behaviors in our docs to guide you. https://magic.link/docs/auth/introduction/test-mode#expected-behavior