separate get into get and getMaybe

This commit is contained in:
Hazelnoot 2025-11-12 01:00:16 -05:00
parent a2ddeb28c3
commit 79289f1a87
2 changed files with 9 additions and 7 deletions

View file

@ -308,7 +308,7 @@ describe(QuantumKVCache, () => {
expect(result).toEqual([]);
});
it('should return the value for all keys', () => {
it('should include the value of all found keys', () => {
const cache = makeCache();
cache.add('foo', 'bar');
cache.add('alpha', 'omega');
@ -318,13 +318,13 @@ describe(QuantumKVCache, () => {
expect(result).toEqual([['foo', 'bar'], ['alpha', 'omega']]);
});
it('should return undefined for missing keys', () => {
it('should exclude all missing keys', () => {
const cache = makeCache();
cache.add('foo', 'bar');
const result = cache.getMany(['foo', 'alpha']);
expect(result).toEqual([['foo', 'bar'], ['alpha', undefined]]);
expect(result).toEqual([['foo', 'bar']]);
});
});