test: clean code output quota assertions

This commit is contained in:
Danny Avila 2026-05-20 14:22:03 -04:00
parent 4a51716951
commit 55a6075aa9
2 changed files with 5 additions and 3 deletions

View file

@ -88,8 +88,7 @@ const removeCacheBuster = (filepath) =>
typeof filepath === 'string' ? filepath.replace(/\?v=\d+$/, '') : filepath;
const getStorageFileId = (fileId, isUpdate) => (isUpdate ? `${fileId}-${v4()}` : fileId);
const getStorageLimitOptions = (fileId, isUpdate) =>
isUpdate ? { excludeFileId: fileId } : undefined;
const getStorageLimitOptions = (fileId, isUpdate) => (isUpdate ? { excludeFileId: fileId } : {});
const cleanupReplacedCodeFile = async (req, previousFile, nextFile) => {
const previousPath = removeCacheBuster(previousFile?.filepath);

View file

@ -333,12 +333,15 @@ describe('Code Process', () => {
const { file: result } = await processCodeOutput(imageParams);
expect(result.bytes).toBe(convertedBytes);
expect(assertFileStorageLimit).toHaveBeenCalledTimes(1);
expect(assertFileStorageLimit).toHaveBeenCalledWith(
expect.objectContaining({
incomingBytes: convertedBytes,
}),
);
expect(assertFileStorageLimit.mock.calls[0][0]).not.toHaveProperty('excludeFileId');
expect(assertFileStorageLimit).toHaveBeenCalledWith(
expect.not.objectContaining({ excludeFileId: expect.anything() }),
);
expect(createFile).toHaveBeenCalled();
});