builtwithelm icon indicating copy to clipboard operation
builtwithelm copied to clipboard

Add Tests for the Built Website

Open prikhi opened this issue 8 years ago • 8 comments
trafficstars

Would be cool if we could add some tests that'd make sure PRs that just add projects can be merged without breaking the site.

Something simple like:

  • projects.json is well formed
  • The image is 1000x800px
  • The image is optimized
  • ?Check projects.json for duplicate project names?

Maybe test that the Elm code compiles w/o errors or warnings while we're at it?

prikhi avatar Oct 07 '17 23:10 prikhi

@prikhi I'm interested in tackling this, perhaps by using http://coala.io - it seems kind of perfectly suited for this. Would that be ok or would the additional dependency be bothersome? If I don't hear back from you I'll likely make a PR anyway... :D

knewter avatar Oct 13 '17 23:10 knewter

Haven't used coala before but seems OK to me :+1: :sparkles:

prikhi avatar Oct 14 '17 00:10 prikhi

I might have to write a custom bear to check the image size but it's easy. Do you do CI anywhere yet? Could run this on travis, should be easy

knewter avatar Oct 14 '17 00:10 knewter

There's no CI for this repo atm, Travis is my usual go to.

prikhi avatar Oct 14 '17 01:10 prikhi

I've added a test for duplicate project names in projects.json - there were three, and I renamed them to specify the author after the project name

knewter avatar Oct 14 '17 02:10 knewter

getting the image size is way harder than it should be because coala is rejecting raw files even though there's explicitly a setting to allow this. Do you know of a good image linter?

knewter avatar Oct 14 '17 02:10 knewter

Dunno what is available on travis, but you could use identify from imagemagick: identify -format "%wx%h" data/images/ABC-editor.jpg or just the file command w/ greps:

$ file ABC-editor.jpg | grep -oE "[^density] ([[:digit:]]+x[[:digit:]]+)" | grep -oE "\S+$"
1000x800

prikhi avatar Oct 14 '17 02:10 prikhi

@knewter Thanks for tackling this project! This is a very welcome addition.

joelclermont avatar Oct 14 '17 18:10 joelclermont