Skip to content

Commit

Permalink
fix: rename setTokenSet
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Jan 10, 2025
1 parent 66c31dd commit a1a8219
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('SafaricomApiService', () => {
access_token: 'mocked-access-token',
expires_at: Date.now() + 10 * 60 * 1000, // 10 minute from now, therefore valid
});
safaricomApiService.setTokenSet(tokenSet);
safaricomApiService.setTokenSetForUnitTest(tokenSet);

// Act
const transferResult = await safaricomApiService.transfer(transferInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ export class SafaricomApiService {
access_token: data.access_token,
expires_at: (data.expires_in - 5 * 60) * 1000 + Date.now(), //expires_in is typically 3599, so in seconds and 1 hour from now. We subtract 5 minutes to be safe.
});

this.setTokenSet(tokenSet);
this.tokenSet = tokenSet;
} catch (error) {
console.error(
'Failed to make OAuth Access Token payment API call',
Expand Down Expand Up @@ -121,7 +120,7 @@ export class SafaricomApiService {
}
}

public setTokenSet(tokenSet: TokenSet): void {
public setTokenSetForUnitTest(tokenSet: TokenSet): void {
// use this as workaround to set tokenSet in unit tests
this.tokenSet = tokenSet;
}
Expand Down

0 comments on commit a1a8219

Please sign in to comment.