Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write unit tests #125

Closed
50 of 55 tasks
wojtekmaj opened this issue Dec 31, 2017 · 0 comments
Closed
50 of 55 tasks

Write unit tests #125

wojtekmaj opened this issue Dec 31, 2017 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@wojtekmaj
Copy link
Owner

wojtekmaj commented Dec 31, 2017

To increase stability and reliability, unit tests have to be written. A lot of them. This will also allow changes like #124 to be ever implemented.

Main issues as for now is inability to run actual rendering in Jest, which makes me unable to run proper tests for PageCanvas and PageSVG. The rest should be fine.

Ideally, unit tests should also cover all bugs that were previously reported.

  • Document
    • loading
      • loads a file via data URI properly
      • loads a file via data URI properly (param object)
      • loads a file via ArrayBuffer properly
      • loads a file via Blob properly
      • loads a file via File properly
      • replaces a file properly
    • rendering
      • applies className to its wrapper when given a string
      • passes container element to inputRef properly
      • renders "No PDF file specified." when given nothing
      • renders custom no data message when given nothing and noData prop is specified
      • renders "Loading PDF..." while loading a document
      • renders custom loading message while loading a document and loading prop is specified
      • renders "Failed to load PDF file." when failed to load a document
      • renders custom error message while loading a document and error prop is specified
      • passes rotate prop to its children
      • does not overwrite rotate prop in its children when given rotate prop to both Document and its children
  • Page
    • loading
      • calls onLoadSuccess when loaded a page
      • calls onLoadError when failed to load a page
      • calls registerPage when loaded a page
      • calls unregisterPage on unmount
      • loads page when given pageIndex
      • loads page when given pageNumber
      • replaces a page properly
      • throws an error when placed outside Document
    • rendering
      • applies className to its wrapper when given a string
      • passes container element to inputRef properly
      • ignores pageIndex when given pageIndex and pageNumber
      • requests page to be rendered with default rotation when given nothing
      • requests page to be rendered with default rotation when given rotate prop
      • requests page to be rendered in canvas mode by default
      • requests page to be rendered in canvas mode when given renderMode = "canvas"
      • requests page to be rendered in SVG mode when given renderMode = "svg"
      • requests text content to be rendered by default
      • requests text content to be rendered when given renderTextLayer= true
      • does not request text content to be rendered when given renderTextLayer= false
      • does not render PageTextContent when given renderMode = "svg"
      • renders PageAnnotations by default
      • renders PageAnnotations when given renderAnnotations = true
      • does not render PageAnnotations when given renderAnnotations = false
  • PageTextContent
    • loading
      • loads text content and calls onGetTextSuccess callback properly
      • calls onGetTextError when failed to load text content
    • rendering
      • renders text content properly
  • PageAnnotations
    • loading
      • loads annotations and calls onGetAnnotationsSuccess callback properly
      • calls onGetAnnotationsError when failed to load annotations
    • rendering
      • renders annotations properly
  • PageCanvas
    • loading
      • calls onRenderSuccess when rendered canvas
      • calls onRenderError when failed to render canvas
    • rendering
      • renders canvas properly
  • PageSVG
    • loading
      • calls onRenderSuccess when rendered SVG
      • calls onRenderError when failed to render SVG
    • rendering
      • renders SVG properly
  • Outline
    • loading
      • loads an outline and calls onLoadSuccess callback properly
      • calls onLoadError when failed to load an outline
      • replaces an outline properly
      • throws an error when placed outside Document
@wojtekmaj wojtekmaj added this to the 2.5.0 milestone Dec 31, 2017
@wojtekmaj wojtekmaj self-assigned this Dec 31, 2017
@wojtekmaj wojtekmaj added the enhancement New feature or request label Dec 31, 2017
@wojtekmaj wojtekmaj modified the milestones: 2.5.0, 3.0.0 Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant