summaryrefslogtreecommitdiff
path: root/internal/processor/processor_test.go
AgeCommit message (Collapse)Author
2026-04-27processor: reject two markdown files claiming the same inbox imagePaul Buetow
The pre-scan claimedByMarkdown used to mark an image as claimed by any markdown that referenced it, but it did not prevent two different markdown files from referencing the same image. When that happened, the first file processed would copy the image into its post directory and then delete it from the inbox. The second file then failed because the source image was already gone. Fix: make image claiming exclusive. claimedByMarkdown now tracks the owning markdown filename for each claimed image and returns an error immediately during the pre-scan if a conflict is detected. This way no sources are removed and no partial posts are created. Also add tests: - twoMarkdownsClaimingSameImageFails (negative) - duplicateImageClaimsInSameMarkdownAllowed (positive)
2026-04-27processor: fix uniqueID to return error instead of infinite loop on Stat errorsPaul Buetow
Previously, uniqueID(postsDir, t) returned only a string and looped forever when os.Stat returned an error other than IsNotExist (e.g. permission denied). Change the signature to (string, error), propagate the error, and update the caller in processFile to handle it. Add positive and negative tests covering new ID generation, suffix collision, and permission-based stat failure.
2026-04-10Release v0.1.3v0.1.3Paul Buetow
Testable CLI flags; version package under internal/version; broad tests for atom, generator, post, processor, and cmd—overall coverage ~85%. Made-with: Cursor