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

Add Tests & 100% Code Coverage (+ some related standardization) #9

Merged
merged 7 commits into from
Dec 3, 2019

Commits on Dec 1, 2019

  1. (test): add initial test harness and one simple test

    - ensure that width/height of canvas are trimmed down after drawing a
      purple rectangle in the center
    
    - add test script that uses jest
      - (ci): change CI to run test and test:pub
    - configure jest and babel-jest
      - add coverage/ directory to gitignore
      - add babel-jest@23 for Babel 6 support
        - and configure it for .js files due to a jest bug
      - add .babelrc to configure babel-jest
        - can't use .babelrc.js as babel-jest@23 doesn't support it
          - jestjs/jest#5324
        - can't use .babelrc for babel-loader (have to duplicate config)
          because babel-loader@6 has some bugs with it and babel-loader@7
          doesn't support webpack@1
          - babel/babel-loader#552
    
    (deps): add jest, babel-jest, and canvas-prebuilt to devDeps
    - add canvas-prebuilt@1 to support jest's jsdom v11
      - canvas is used by jsdom for, well, canvas interactions
    agilgur5 committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    a5690f6 View commit details
    Browse the repository at this point in the history
  2. (test): make test more complex to handle more use cases

    - so it's not just handling one single square in the middle, make the
      shape more complex to ensure algorithm works properly
    agilgur5 committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    f0d1505 View commit details
    Browse the repository at this point in the history
  3. (test): ensure edge case of all whitespace is handled

    - currently returns a 1x1 canvas... should probably be 0x0, but that
      requires some refactoring and may be a breaking change if anyone
      is relying on that behavior
      - reliance on that behavior may certainly be possible given how long
        this library has gone without a release, though no one's reported
        that as a bug either
      - it's a pretty big edge case, so I'm not sure that it matters much
        either way tbh
    
    - also, this gets us to 100% code coverage!!
    agilgur5 committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    614baef View commit details
    Browse the repository at this point in the history
  4. (ci/test): add CodeCov test coverage reporting

    - change CI to output and upload coverage reports
    
    - (docs): add dat slick coverage: 100% badge to README
    agilgur5 committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    c8b1ff0 View commit details
    Browse the repository at this point in the history
  5. (refactor): move index.js into src/

    - standardize w/ the rest of my libraries and better parity between
      test/ and src/
    agilgur5 committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    46121d0 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2019

  1. (refactor): use const everywhere instead of let

    - none of these variables are ever re-assigned
      - and new standard linter versions error on that
      - I wrote this a while ago when ES6 was new and just used `let` for
        everything instead of `var` at the time. Now ofc I use `const`
        everywhere and `let` when needed
        - also replace `var` in for loops with block-scoped `let`
    
    - change docs to use const as well
    agilgur5 committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    16174e4 View commit details
    Browse the repository at this point in the history
  2. (env/refactor): standardize .gitignore

    - basically the same one I use in all my other libraries
      - I believe it's an old version of Node output from gitignore.io iirc
    - it has comments unlike the old one, so that's much nicer for those
      who aren't totally sure what each entry is for
    agilgur5 committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    2435a1b View commit details
    Browse the repository at this point in the history