Skip to content

Commit

Permalink
adding test case for type DecodedJwt
Browse files Browse the repository at this point in the history
  • Loading branch information
msgadi committed Dec 12, 2024
1 parent 8b3a1a1 commit f507195
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,16 @@ expectNotAssignable<JwtHeader>(signerOptionsNoAlg.header)

// Check all errors are typed correctly
expectType<TokenValidationErrorCode[]>(Object.values(TokenError.codes))

const decodedJwt: DecodedJwt = {
header: { alg: 'RS256', typ: 'JWT' },
payload: { sub: '12345', iss: 'iss' },
signature: 'abc123',
input: 'sample-token'
}

expectType<DecodedJwt>(decodedJwt)
expectType<Record<string, any>>(decodedJwt.header)
expectType<any>(decodedJwt.payload)
expectType<string>(decodedJwt.signature)
expectType<string>(decodedJwt.input)

0 comments on commit f507195

Please sign in to comment.