11import { getBearerTokenEnvKey } from "@aws-sdk/core" ;
22import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
33
4- import { fromEnvBearerToken } from "./fromEnvBearerToken " ;
4+ import { fromEnvSigningName } from "./fromEnvSigningName " ;
55
66vi . mock ( "@aws-sdk/core" ) ;
77
8- describe ( "fromEnvBearerToken" , ( ) => {
8+ describe ( fromEnvSigningName . name , ( ) => {
99 const originalEnv = process . env ;
1010 const mockInit = { signingName : "signing name" } ;
1111 const mockBearerTokenEnvKey = "AWS_BEARER_TOKEN_SIGNING_NAME" ;
@@ -22,14 +22,14 @@ describe("fromEnvBearerToken", () => {
2222
2323 describe ( "throws error" , ( ) => {
2424 it ( "when signingName is not passed" , async ( ) => {
25- await expect ( fromEnvBearerToken ( ) ( ) ) . rejects . toThrow (
25+ await expect ( fromEnvSigningName ( ) ( ) ) . rejects . toThrow (
2626 "Please pass 'signingName' to compute environment variable key"
2727 ) ;
2828 expect ( getBearerTokenEnvKey ) . not . toHaveBeenCalled ( ) ;
2929 } ) ;
3030
3131 it ( "when token is not present in environment variable" , async ( ) => {
32- await expect ( fromEnvBearerToken ( mockInit ) ( ) ) . rejects . toThrow (
32+ await expect ( fromEnvSigningName ( mockInit ) ( ) ) . rejects . toThrow (
3333 `Token not present in '${ mockBearerTokenEnvKey } ' environment variable`
3434 ) ;
3535 expect ( getBearerTokenEnvKey ) . toHaveBeenCalledWith ( mockInit . signingName ) ;
@@ -39,7 +39,7 @@ describe("fromEnvBearerToken", () => {
3939 it ( "returns token from environment variable" , async ( ) => {
4040 const mockBearerToken = "mock-bearer-token" ;
4141 process . env [ mockBearerTokenEnvKey ] = mockBearerToken ;
42- const token = await fromEnvBearerToken ( mockInit ) ( ) ;
42+ const token = await fromEnvSigningName ( mockInit ) ( ) ;
4343 expect ( token ) . toEqual ( { token : mockBearerToken } ) ;
4444 expect ( getBearerTokenEnvKey ) . toHaveBeenCalledWith ( mockInit . signingName ) ;
4545 } ) ;
0 commit comments