You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app needs to fetch markup from the HN server and parse them into JSON. In order to prevent regressions in the parser, I have downloaded a bunch of HTML pages and put them in /tests/fixtures and froze the JSON output in there. So everytime I make changes to the parser, I can run the tests again and see the diff and decide if it's legit or not.
There's a in-repo add-on for making these fixtures available to the tests.
The HTML fixtures serves another purpose – there's a pretender server in /tests/helpers that serves these things to the integration tests. I hacked in an offline development mode (OFFLINE=1 ember server) which runs the dev server with the pretender thing enabled, so you can work on this without wifi.
I think these ideas are pretty great, but the implementations, not so much.
Problems:
To make the fixtures available to the tests, I wrote this "fixture-packer" add-on (in lib). It was one of my first broccoli/add-on thing so the implementation is probably terrible. I also wrote a lot of features that I thought was cool but never used (import specificFixture from 'some/deeply/nested/thing' instead of justimport fixtures from 'all_the_things` and access it normally). I am pretty sure reading fixture files of some sort is a pretty common need, so we should either find something that already does this, or if that doesn't exists then improve/simplify/refactor the thing in there and extract it into a real add-on.
The fixtures are huge! I think I am storing way too many of them (first 5 listing/index pages of each category/filter, then the individual item pages for the first 10 stories in each). They take up a lot of space too. And they make the repo size pretty big, because old fixtures stays in the git history too. (I think I nuked all of them at some point and re-downloaded them from HN, but the old ones are still stuck in the git history hell somewhere.)
The process of updating the JSON fixtures is mega HAX. I'd empty out the JSON fixture files, run the tests (which would be failing of course) and extract actual result from the qunit reporter :P I guess what I really want is to be able to run the "extractors" as a standalone script, so after I downloaded new HTML fixtures, I can generate the JSON fixtures by run_that_extractor_somehow html_fixture.html > json_fixture.json.
The text was updated successfully, but these errors were encountered:
Let me explain the idea:
The app needs to fetch markup from the HN server and parse them into JSON. In order to prevent regressions in the parser, I have downloaded a bunch of HTML pages and put them in /tests/fixtures and froze the JSON output in there. So everytime I make changes to the parser, I can run the tests again and see the diff and decide if it's legit or not.
There's a in-repo add-on for making these fixtures available to the tests.
The HTML fixtures serves another purpose – there's a pretender server in /tests/helpers that serves these things to the integration tests. I hacked in an offline development mode (
OFFLINE=1 ember server
) which runs the dev server with the pretender thing enabled, so you can work on this without wifi.I think these ideas are pretty great, but the implementations, not so much.
Problems:
import specificFixture from 'some/deeply/nested/thing' instead of just
import fixtures from 'all_the_things` and access it normally). I am pretty sure reading fixture files of some sort is a pretty common need, so we should either find something that already does this, or if that doesn't exists then improve/simplify/refactor the thing in there and extract it into a real add-on.actual
result from the qunit reporter :P I guess what I really want is to be able to run the "extractors" as a standalone script, so after I downloaded new HTML fixtures, I can generate the JSON fixtures byrun_that_extractor_somehow html_fixture.html > json_fixture.json
.The text was updated successfully, but these errors were encountered: