I'm writing a test to check if the output printed to the console matches the JSON string I expect.
(deftest create-account-test
(testing "Create account"
(is (= (str (cheshire/generate-string {:account {:active-card true :available-limit 100} :violations []}))
(with-out-str
(io/-main "test/sample-input.txt"))))))
The test breaks due to a mismatch: the \n that comes at the end of the actual output:
actual: "{\"account\":{\"active-card\":true,\"available-limit\":100},\"violations\":[]}\n"
diff: - "{\"account\":{\"active-card\":true,\"available-limit\":100},\"violations\":[]}"
+ "{\"account\":{\"active-card\":true,\"available-limit\":100},\"violations\":[]}\n"
How should I deal with this newline at the end?
I considered concatenating a \newline with the expected string, but I guess there's a better solution.