I suddenly remembered Voltaire's Candide. That's basically a book about exposing and ridiculing optimists as buffoons. Well, not exactly, but that's the gist of it.
Besides a fun read, the book is more a critique of the philosophical notion of Optimism, i.e. the idea that we are living in the optimal "timeline". Even if this reality is shit, Optimism states it's still better than all others that could possibly be.