opawg / user-agents

An open, platform-agnostic list of user-agent and referrer regexes for use in podcast analytics services
MIT License
123 stars 71 forks source link

Automated tests #125

Open jdelStrother opened 1 year ago

jdelStrother commented 1 year ago

Any interest in adding more tests to this project?

I hacked together https://github.com/jdelStrother/user-agents/commit/995af44be47b403216bfcf11f385cee9b0e96a28 that just checks that all the examples listed in the json match one of the user_agents regexes. (half-a-dozen or so seem to have bad example UAs: https://github.com/jdelStrother/user-agents/actions/runs/3439700273/jobs/5737297616).

I didn't bother adding an actual test framework (eg jest) because I struggled to think of other tests I wanted to add, but I could add one if we thought it might expand in usage.

johnspurlock commented 1 year ago

There is a new version of this user-agents list over in opawg/user-agents-v2 that performs automated tests on every push/PR. In addition to basic JSON sanity checking, it also ensures that every example lands on its containing entry (and adds quite a few more examples!)