davexunit/yon-chan — pull request #6 by ShanaTsunTsunLove (2013-05-04 00:23:19+00:00)
Title: Tests, stubs, full API coverage

* Added all possible fields that we can receive from 4chan to our post object
* This results in a fairly large object. I guess it could be split into some logical, smaller modules (such as grouping fields relevant to the image) but I think it would end up as more of a nuisance to deal with.
* Moved greentext and deadlink tests to testing with ert, like they should be
* Put in some real JSON requests in features/stubs as well as some (still real) small ones
* Added unit tests for catalog parsing and rendering (as it exists right now)
* Messed around with the testing scripts to allow output hiding in case we don't want to see the huge printout of all tests unless they fail. Should still work fine as they did before.
* Travis special-cased to always print everything

I think that's everything.

There's a small issue with the `test-yon-build-post`. It passes as it is but just using `make-yon-post` under the expected field will not cut it if you want to extend the test to more fields. The reason is that `yon-build-post` will honour the defaults you set in the function while just making the object by hand won't. E.g.: removing the `subject` field from the test and mock-up returns a failing test because `nil ≠ "No subject". The solution will be to list all the fields without defaults. Or something. Nothing major as long as it's covered at least once.

```
Test test-yon-build-post condition:
(ert-test-failed
((should
(equalp
(yon-build-post response)
expected))
:form
(equalp
[cl-struct-yon-post "No subject" "Anonymous" "right now" 9001 "This is a test" nil nil nil nil ...]
[cl-struct-yon-post nil "Anonymous" "right now" 9001 "This is a test" nil nil nil nil ...])
:value nil))
```

A lot of these changes are on separate branches if you wanted to cherry-pick.