Replies: 1 comment
-
| This is where I'm hitting the error  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
i'm trying to create a unit test of a function/service which basically just encapculates SignJWT.
// service for example purposes
The code works perfectly and so easy to use. it creates a token as expected. but now I'd like to unit test that the token gets created properly much like this example you have:
https://github.com/panva/jose/blob/main/test/jwt/sign.test.mjs#L18-L26
Inside of a jest assertion, example purposes
if i test everything before that, setProtectedHeaders, i am able to expect
toEqualthe correct header and payloadbut i can't test sign(), it fails with this error when it gets to
.sign()i'm also able to set spyOn sign(), so that i can see that it gets called in the creation of the token.
but i'm stuck with this error - how can i test with jest to expect it to be equal to a specific token like in your example?
Beta Was this translation helpful? Give feedback.
All reactions