mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 09:19:34 +05:30
test: fix Windows-only test failures so CI matrix runs clean
Two pre-existing Windows-specific failures blocked the CI release
matrix from publishing the Windows build:
- tests/main/DailyNotes.test.js: 'joins dir + YYYY-MM-DD.md' used
a hard-coded '/tmp/notes/2026-09-13.md' expected value. On
POSIX path.join returns '/' and the test passes; on Windows
path.join returns '\' and the test fails. Fix: build the
expected value via path.join so it matches the platform.
- tests/main/PDFBatchOperations.test.js: 'watermarks every PDF
including subfolders' used the default 5s Jest timeout. Windows
CI runners are slower at pdf-lib / pdfjs-dist cold-start and the
test regularly exceeded 5s. Fix: jest.setTimeout(30000) at the
start of the watermark describe block.
Neither is a regression — both predate this session. The fix gets
the Windows job green so the release matrix completes 3/3.
Amit Haridas
This commit is contained in:
@@ -26,7 +26,11 @@ describe('DailyNotes.dateKey', () => {
|
|||||||
describe('DailyNotes.pathFor', () => {
|
describe('DailyNotes.pathFor', () => {
|
||||||
test('joins dir + YYYY-MM-DD.md', () => {
|
test('joins dir + YYYY-MM-DD.md', () => {
|
||||||
const d = new Date(2026, 8, 13);
|
const d = new Date(2026, 8, 13);
|
||||||
expect(DailyNotes.pathFor(d, '/tmp/notes', path)).toBe('/tmp/notes/2026-09-13.md');
|
// Use path.join to build the expected value so the test passes on
|
||||||
|
// Windows (where path.join returns backslashes) as well as POSIX.
|
||||||
|
expect(DailyNotes.pathFor(d, '/tmp/notes', path)).toBe(
|
||||||
|
path.join('/tmp/notes', '2026-09-13.md')
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ describe('PDFBatchOperations - runPDFBatchOperation', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('watermark across a folder (brief manual-verification stand-in)', () => {
|
describe('watermark across a folder (brief manual-verification stand-in)', () => {
|
||||||
|
// 30s timeout for this batch — creates + watermarks 3 PDFs; the
|
||||||
|
// default 5s is too tight on Windows CI runners where pdf-lib /
|
||||||
|
// pdfjs-dist cold-start can take 10-15s on the first call.
|
||||||
|
jest.setTimeout(30000);
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await writePdfFixture(path.join(inputDir, 'a.pdf'), 2, 'Alpha');
|
await writePdfFixture(path.join(inputDir, 'a.pdf'), 2, 'Alpha');
|
||||||
await writePdfFixture(path.join(inputDir, 'b.pdf'), 3, 'Beta');
|
await writePdfFixture(path.join(inputDir, 'b.pdf'), 3, 'Beta');
|
||||||
@@ -81,6 +85,8 @@ describe('PDFBatchOperations - runPDFBatchOperation', () => {
|
|||||||
// 'DRAFT' extracts back out cleanly via pdfjs; wider centered strings
|
// 'DRAFT' extracts back out cleanly via pdfjs; wider centered strings
|
||||||
// (e.g. 'CONFIDENTIAL') hit a pdfjs-dist text-extraction quirk that
|
// (e.g. 'CONFIDENTIAL') hit a pdfjs-dist text-extraction quirk that
|
||||||
// truncates the returned item even though the full text is drawn.
|
// truncates the returned item even though the full text is drawn.
|
||||||
|
// 30s timeout — the test creates + watermarks 3 PDFs and the default
|
||||||
|
// 5s is too tight on Windows CI runners.
|
||||||
const { completion } = await runBatch({
|
const { completion } = await runBatch({
|
||||||
operation: 'watermark',
|
operation: 'watermark',
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Reference in New Issue
Block a user