feat: publish av-tools 0.1.0

This commit is contained in:
2026-07-24 14:58:03 +02:00
commit fcc537b024
254 changed files with 63270 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import { describe, expect, it } from 'vitest';
import {
cacheDerivative,
readCachedDerivative,
} from '../../src/app/derived-cache';
describe('application derivative cache', () => {
it('reuses only an exact source and settings identity', async () => {
const file = new File(['source'], 'preview-source.mp4', {
type: 'video/mp4',
lastModified: 123,
});
const settings = {
maxDurationSeconds: 30,
maxWidth: 960,
includeAudio: true,
};
const derivative = new Blob(['proxy'], { type: 'video/mp4' });
await cacheDerivative(
file,
'preview-proxy-test',
'preview-proxy',
'project-preview-cache-test',
derivative,
settings
);
expect(
await readCachedDerivative(file, 'preview-proxy-test', settings)
).toEqual(derivative);
expect(
await readCachedDerivative(file, 'preview-proxy-test', {
...settings,
maxWidth: 1280,
})
).toBeUndefined();
expect(
await readCachedDerivative(
new File(['other'], file.name, {
type: file.type,
lastModified: file.lastModified,
}),
'preview-proxy-test',
settings
)
).toBeUndefined();
});
});