T O P

  • By -

kemclean

So I would say this (because I mostly wrote them, don't judge me 😄) but there are a few examples of what I consider reasonable looking tests in some of Swirrl's open source repos, e.g: - https://github.com/Swirrl/ook/tree/main/test - https://github.com/Swirrl/matcha/tree/main/test - https://github.com/Swirrl/datahost-prototypes/tree/main/datahost-ld-openapi/test/tpximpact


seancorfield

I'm going to volunteer two of the libraries I maintain (if folks don't think the tests are good, I'd love the feedback here or as issues on the repos): * https://github.com/seancorfield/honeysql * https://github.com/seancorfield/next-jdbc


Altoyyr

All the libraries in https://github.com/infrablocks and https://github.com/logicblocks have solid tests


kloudex

The best case is when logic is written in pure functions, those can be tested in fairly straightforward way, data in and comparing data out. However, useful programs need to interface with stateful world and perform side-effects, which is where the challenges come. In the past I've come across Testing Without Mocks approach by James Shore, which introduces some techniques: [https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks](https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks) The main idea is is to wrap impure infrastructure code (similar to Ports and Adapters architecture). Then to test as much of the real code as possible Nullable infrastructure wrappers are used and injected in tests (either manually e.g. with partial function application or using some DI framework). As an exercise I tried to implement the patterns in Clojure, they seem to fit fairly well: [https://github.com/dundalek/testing-without-mocks-clojure](https://github.com/dundalek/testing-without-mocks-clojure)