Skip to content

Commit

Permalink
add extra test to large-messages.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
anitarua committed Oct 25, 2024
1 parent c2c0140 commit eb7f318
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,22 @@ describe('CacheClient', () => {
expect(responseValue).toEqual(value);
}, `expected 5mb retrieved string to match 5mb value that was set for key ${key}`);
});

it('should fail with RESOURCE_EXHAUSTED_ERROR when setting a value greater than 5mb', async () => {
const cacheKey = v4();
const cacheValue = 'x'.repeat(5_300_000);
const setResponse = await cacheClient.set(
integrationTestCacheName,
cacheKey,
cacheValue
);
const stringifiedSetResponse = setResponse.toString();
expectWithMessage(() => {
expect(setResponse).toBeInstanceOf(CacheSet.Error);
}, `expected ERROR but got ${stringifiedSetResponse}`);
expect(stringifiedSetResponse).toInclude('RESOURCE_EXHAUSTED');
expect(stringifiedSetResponse).toInclude(
'Request size limit exceeded for this account'
);
});
});

0 comments on commit eb7f318

Please sign in to comment.