abcnews / aunty

A toolkit for working with ABC News projects
https://www.npmjs.com/package/@abcnews/aunty
MIT License
32 stars 5 forks source link

Add jest tests for generate & build processes #213

Closed AshKyd closed 1 year ago

AshKyd commented 1 year ago

By exposing the generate & build methods directly to Jest we can skip the command line and test programmatically.

I picked Jest because it's fairly standard and will work everywhere.

To try it out, run npm test:

image

PS: this is a shocking diff. Use "hide whitespace" mode for a better experience.

image

AshKyd commented 1 year ago

You're not wrong about the diff 🤪

Ah I worked out what went wrong. If you ignore whitespace it's only a couple of lines changed.

image

AshKyd commented 1 year ago

Thanks @drzax. I double checked and your assumptions are correct. I've left code comments as such. I've also included your suggestions and added a Github Workflow to run the tests in CI. I think this is ready to review now 👍

AshKyd commented 1 year ago

Just wondering if your editor is setup to follow .editorconfig files. Theoretically there shouldn't be whitespace only differences, I thought.

This is because I split the code out from the wrapper function, so the indentation changed. Can't be helped here.