Skip to content

Add unit tests for annotation templates service#61

Closed
ElMaxter99 wants to merge 4 commits intodevelopfrom
alvaromaxter/add-tests-for-annotationtemplatesservice
Closed

Add unit tests for annotation templates service#61
ElMaxter99 wants to merge 4 commits intodevelopfrom
alvaromaxter/add-tests-for-annotationtemplatesservice

Conversation

@ElMaxter99
Copy link
Owner

@ElMaxter99 ElMaxter99 commented Oct 30, 2025

Summary

  • add coverage for AnnotationTemplatesService including default template ordering and name normalization
  • mock window.localStorage to simulate quota errors and unavailable storage
  • configure a CI workflow to run npm test in ChromeHeadless for pull requests

Testing

  • npm run test -- --watch=false --browsers=ChromeHeadless (fails locally: no Chrome binary available in container)

@vercel
Copy link

vercel bot commented Oct 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
pdf-annotator Ready Ready Preview Comment Oct 30, 2025 3:53pm

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 49 to 53
function overrideLocalStorage(value: Storage | undefined) {
Object.defineProperty(window, 'localStorage', {
configurable: true,
value,
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid redefining window.localStorage via Object.defineProperty

The tests stub window.localStorage by redefining the property with Object.defineProperty. In real browsers (including ChromeHeadless used in CI) the localStorage attribute is non‑configurable, so this call throws TypeError: Cannot redefine property: localStorage before the suite even runs. As written, the new tests will fail in CI. Consider using spyOnProperty(window, 'localStorage', 'get') or another mechanism that does not attempt to redefine the built‑in property.

Useful? React with 👍 / 👎.

@ElMaxter99
Copy link
Owner Author

Descarto agregar CI / CD hasta q tenga una versión mas duradera del proyecto

@ElMaxter99 ElMaxter99 closed this Oct 30, 2025
@ElMaxter99 ElMaxter99 deleted the alvaromaxter/add-tests-for-annotationtemplatesservice branch October 30, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant