Skip to content

Commit

Permalink
fix: empty string doesn't work for CredentialProvider.fromString test
Browse files Browse the repository at this point in the history
  • Loading branch information
cprice404 committed Jan 17, 2024
1 parent 56757ac commit 5e6ab76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {
} from '../../src';
import {credsProvider} from './integration-setup';

// These tokens have valid syntax, but they don't actually have valid credentials. Just used for unit testing.
const fakeTestV1ApiKey =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2NzgzMDU4MTIsImV4cCI6NDg2NTUxNTQxMiwiYXVkIjoiIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSJ9.8Iy8q84Lsr-D3YCo_HP4d-xjHdT8UCIuvAYcxhFMyz8';

describe('default configurations', () => {
it('CacheClient should be able to be constructed with a default configuration', async () => {
const cacheClientViaConstructor = new CacheClient({
Expand Down Expand Up @@ -41,7 +45,7 @@ describe('default configurations', () => {

it('CacheClient should be able to be constructed with a simple string for fromString', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider: CredentialProvider.fromString(''),
credentialProvider: CredentialProvider.fromString(fakeTestV1ApiKey),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {
} from '../../src';
import {credsProvider} from './integration-setup';

// These tokens have valid syntax, but they don't actually have valid credentials. Just used for unit testing.
const fakeTestV1ApiKey =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2NzgzMDU4MTIsImV4cCI6NDg2NTUxNTQxMiwiYXVkIjoiIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSJ9.8Iy8q84Lsr-D3YCo_HP4d-xjHdT8UCIuvAYcxhFMyz8';

describe('default configurations', () => {
it('CacheClient should be able to be constructed with a default configuration', () => {
const cacheClientViaConstructor = new CacheClient({
Expand Down Expand Up @@ -35,7 +39,7 @@ describe('default configurations', () => {

it('CacheClient should be able to be constructed with a simple string for fromString', () => {
const cacheClientViaConstructor = new CacheClient({
credentialProvider: CredentialProvider.fromString(''),
credentialProvider: CredentialProvider.fromString(fakeTestV1ApiKey),
defaultTtlSeconds: 60,
});
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
Expand Down

0 comments on commit 5e6ab76

Please sign in to comment.