Skip to content

Add unit tests for slide compilation and editable PPTX scripts - #4

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783562817-add-unit-tests
Closed

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783562817-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repo had no test suite — all three scripts/ modules were at 0% coverage. This adds unit tests covering the highest-value logic in each, plus a CI workflow to run them.

Coverage after this PR:

  • compile_slide_images_to_pdf.py → 97%
  • merge_editable_slide_outputs.py → 95%
  • build_editable_ppt_from_layers.mjs → pure helpers fully covered (88% branch)

Python (pytest, 55 tests)

tests/conftest.py puts scripts/ on sys.path so the CLI modules import directly. Tests exercise pure helpers (natural_key, parse_size, load_manifest, collect_images, aspect_error, normalize_image, slide_number, extract_texts, find_text_layer/find_page_dir, collect_slide_dirs) plus end-to-end runs of build_pdf and each main() using real PIL-generated images and temp dirs — asserting PDF/report output, --strict aspect rejection, and --force overwrite behavior.

JS (node:test, 31 tests)

The runner was refactored minimally to make functions importable — main() now only auto-runs when invoked directly, and pure functions are exported:

const invokedDirectly = Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;
if (invokedDirectly) { main().catch(...) }
export { parseArgs, slideSize, visibleStyleValue, assetPosition, normalizePptxColor, pptxScale, ... };

Tests cover arg parsing, style/visibility resolution (visibleStyleValue, lineFillValue, lineWidthValue, collectTextFillViolations), coordinate math (assetPosition canvas scaling, pptxScale, toPptxPosition), color normalization, and findPageDir filesystem lookup. The backend builders (which need the pptxgenjs / Codex Presentations runtime) are left out intentionally.

Tooling

  • pyproject.toml — pytest config (testpaths = ["tests"])
  • requirements-dev.txt — pytest + pytest-cov
  • package.json — npm test / npm run test:coverage
  • .github/workflows/tests.yml — runs both suites on push/PR
  • .gitignore — coverage artifacts

Run locally: pytest and npm test.

Link to Devin session: https://app.devin.ai/sessions/1be4e51064554956b8a57786e86ff394
Requested by: @qybaihe

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@qybaihe qybaihe self-assigned this Jul 9, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@qybaihe

qybaihe commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Superseded and incorporated into release v0.3.0 (56da0cc).

@qybaihe qybaihe closed this Oct 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

❌ Cannot revive Devin session - the session is too old. Please start a new session instead.

View session

@qybaihe
qybaihe deleted the devin/1783562817-add-unit-tests branch October 26, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant