Skip to content

Commit

Permalink
feat: add cacheclient.create function in web sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta committed Jul 9, 2024
1 parent 6ec11fc commit 3ee4cfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/client-sdk-web/src/cache-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class CacheClient extends AbstractCacheClient implements ICacheClient {
public get configuration(): Configuration {
return this._configuration;
}

public static create(cacheClientProps: CacheClientProps): CacheClient {
return new CacheClient(cacheClientProps);
}
}

function createControlClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ describe('default configurations', () => {
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
});

it('CacheClient should be able to be constructed with create function', () => {
const cacheClientViaCreate = CacheClient.create({
credentialProvider: CredentialProvider.fromString(fakeTestV1ApiKey),
defaultTtlSeconds: 60,
});
expect(cacheClientViaCreate).toBeInstanceOf(CacheClient);
});

it('TopicClient should be able to be constructed with a default configuration', () => {
const topicClientViaConstructor = new TopicClient({
credentialProvider: credsProvider(),
Expand Down

0 comments on commit 3ee4cfc

Please sign in to comment.