Traewelling / line-colors

This repository collects German public transport line colors.
https://traewelling.github.io/line-colors/
Creative Commons Zero v1.0 Universal
29 stars 41 forks source link

✅ add hex-color validator and add unit tests for the validation rules #42

Closed jeyemwey closed 11 months ago

jeyemwey commented 11 months ago

This PR adds a validation rule for the color fields which should always be 6-digit hex codes with a # in front (inspired by https://github.com/Traewelling/line-colors/pull/40). Turns out there were even more cases where that wasn't set properly!

Since the validation rules are getting more and more complex, I've added a very barebones unit test framework which can cross-check if the rules are doing what we want them to. This turned out to be the larger part of this PR.

Hope it's alright for y'all and hopefully this can add to a better data quality overall.