import { cutoutPathFor } from '../../src/intake/backgroundRemoval'; describe('where a cut-out is written', () => { // A new file rather than a rewrite of the original, which is what makes the // original restorable at all — and what makes the JPEG-to-PNG change free, // since no existing path is renamed. it('sits beside the original with a -cutout suffix and a .png extension', () => { expect(cutoutPathFor('/uploads/abc-123.jpg')).toBe('/uploads/abc-123-cutout.png'); }); // image_path is a contract, not a string: #103 made the stored value the // path uploadUrl joins an origin onto. it('keeps the /uploads/ prefix', () => { expect(cutoutPathFor('/uploads/x.webp')).toBe('/uploads/x-cutout.png'); }); // The extension is replaced rather than appended, so a second pass cannot // produce `.png.png`. it('replaces the extension rather than appending to it', () => { expect(cutoutPathFor('/uploads/x.png')).toBe('/uploads/x-cutout.png'); }); });