{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1374","repository_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1374/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1374/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1374/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/pull/1374","id":350547910,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4MzcyMDIx","number":1374,"title":"Adds assert for association definition","user":{"login":"Duder-onomy","id":1612785,"node_id":"MDQ6VXNlcjE2MTI3ODU=","avatar_url":"https://avatars1.githubusercontent.com/u/1612785?v=4","gravatar_id":"","url":"https://api.github.com/users/Duder-onomy","html_url":"https://github.com/Duder-onomy","followers_url":"https://api.github.com/users/Duder-onomy/followers","following_url":"https://api.github.com/users/Duder-onomy/following{/other_user}","gists_url":"https://api.github.com/users/Duder-onomy/gists{/gist_id}","starred_url":"https://api.github.com/users/Duder-onomy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Duder-onomy/subscriptions","organizations_url":"https://api.github.com/users/Duder-onomy/orgs","repos_url":"https://api.github.com/users/Duder-onomy/repos","events_url":"https://api.github.com/users/Duder-onomy/events{/privacy}","received_events_url":"https://api.github.com/users/Duder-onomy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-14T18:35:16Z","updated_at":"2018-08-14T18:49:35Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/pulls/1374","html_url":"https://github.com/samselikoff/ember-cli-mirage/pull/1374","diff_url":"https://github.com/samselikoff/ember-cli-mirage/pull/1374.diff","patch_url":"https://github.com/samselikoff/ember-cli-mirage/pull/1374.patch"},"body":"Hey! This repo is awesome. I have honestly never seen a test 'sweet' as expansive as this one.\r\n\r\nI came across an issue in my code where I had not explicitly defined an association that I was posting via the relationships attr. (json:api) \r\n\r\nThis resulted in a javascript exception on [this line](https://github.com/samselikoff/ember-cli-mirage/blob/master/addon/route-handlers/base.js#L66): around not being able to access the property `isPolymorphic of undefined`. \r\n\r\nThis PR adds a simple assert in that code to help people fix this problem if they hit it. \r\n\r\n* Adds assert that ensures associations are defined when being included in json:api post requests\r\n\r\nI tried to match the language style from other asserts. "},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/412977231","html_url":"https://github.com/samselikoff/ember-cli-mirage/pull/1374#issuecomment-412977231","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1374","id":412977231,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjk3NzIzMQ==","user":{"login":"samselikoff","id":2922250,"node_id":"MDQ6VXNlcjI5MjIyNTA=","avatar_url":"https://avatars1.githubusercontent.com/u/2922250?v=4","gravatar_id":"","url":"https://api.github.com/users/samselikoff","html_url":"https://github.com/samselikoff","followers_url":"https://api.github.com/users/samselikoff/followers","following_url":"https://api.github.com/users/samselikoff/following{/other_user}","gists_url":"https://api.github.com/users/samselikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/samselikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samselikoff/subscriptions","organizations_url":"https://api.github.com/users/samselikoff/orgs","repos_url":"https://api.github.com/users/samselikoff/repos","events_url":"https://api.github.com/users/samselikoff/events{/privacy}","received_events_url":"https://api.github.com/users/samselikoff/received_events","type":"User","site_admin":false},"created_at":"2018-08-14T18:49:35Z","updated_at":"2018-08-14T18:49:35Z","author_association":"OWNER","body":"Excellent! And thanks for the kind words!\r\n\r\nGreat addition – can we get a test in here too?\r\n\r\nHere's the test module for a simple function route handler: https://github.com/samselikoff/ember-cli-mirage/blob/master/tests/integration/route-handlers/function-handler-test.js.\r\n\r\nYou can see [here](https://github.com/samselikoff/ember-cli-mirage/blob/2ef1b592edd5e30db2b41d9a6103b69f1a3c5ea9/tests/integration/route-handlers/function-handler-test.js#L155) how to use `assert.throws` to write a test that expects an error to throw.\r\n\r\nIf you wanted, you could make a new file under `tests/integration/route-handlers` called `assertions-test` so you can set up a new server on its own.\r\n\r\nThanks again and let me know if you need any help! ✨ "}}
{"actor":{"display_login":"samselikoff"}}