Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for deleting keys #68

Merged
merged 4 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion integration/SimpleCacheClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {v4} from 'uuid';
import * as fs from 'fs';
import * as os from 'os';
import {SimpleCacheClient, TimeoutError} from '../src';
import {CacheGetStatus, SimpleCacheClient, TimeoutError} from '../src';
import {AlreadyExistsError, NotFoundError} from '../src/Errors';
import {TextEncoder} from 'util';

Expand Down Expand Up @@ -193,6 +193,18 @@ describe('SimpleCacheClient.ts Integration Tests', () => {
);
await momento.deleteCache(cacheName);
});
it('should set and then delete a value in cache', async () => {
const cacheKey = v4();
const cacheValue = new TextEncoder().encode(v4());
await momento.set(INTEGRATION_TEST_CACHE_NAME, cacheKey, cacheValue);
const getSuccess = await momento.get(INTEGRATION_TEST_CACHE_NAME, cacheKey);
// validate set worked correctly
expect(getSuccess.bytes()).toEqual(cacheValue);

await momento.delete(INTEGRATION_TEST_CACHE_NAME, cacheKey);
const getMiss = await momento.get(INTEGRATION_TEST_CACHE_NAME, cacheKey);
expect(getMiss.status).toEqual(CacheGetStatus.Miss);
});
it('should create, list, and revoke a signing key', async () => {
const momento = new SimpleCacheClient(AUTH_TOKEN, 1111);
const createSigningKeyResponse = await momento.createSigningKey(30);
Expand Down
Loading