{"action":"closed","issue":{"url":"https://api.github.com/repos/TIY-GVL-FEE-2015-August/assignments/issues/236","labels_url":"https://api.github.com/repos/TIY-GVL-FEE-2015-August/assignments/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/TIY-GVL-FEE-2015-August/assignments/issues/236/comments","events_url":"https://api.github.com/repos/TIY-GVL-FEE-2015-August/assignments/issues/236/events","html_url":"https://github.com/TIY-GVL-FEE-2015-August/assignments/issues/236","id":108125706,"number":236,"title":"5.3-tooter-Richard Freeman","user":{"login":"rfree86","id":13687506,"avatar_url":"https://avatars.githubusercontent.com/u/13687506?v=3","gravatar_id":"","url":"https://api.github.com/users/rfree86","html_url":"https://github.com/rfree86","followers_url":"https://api.github.com/users/rfree86/followers","following_url":"https://api.github.com/users/rfree86/following{/other_user}","gists_url":"https://api.github.com/users/rfree86/gists{/gist_id}","starred_url":"https://api.github.com/users/rfree86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfree86/subscriptions","organizations_url":"https://api.github.com/users/rfree86/orgs","repos_url":"https://api.github.com/users/rfree86/repos","events_url":"https://api.github.com/users/rfree86/events{/privacy}","received_events_url":"https://api.github.com/users/rfree86/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-24T13:05:26Z","updated_at":"2015-09-25T01:57:02Z","closed_at":"2015-09-25T01:57:02Z","body":"# JavaScript Test Practice\r\n\r\n## Description\r\nGain beginning familiarity with writing front end tests\r\n\r\n## Objectives\r\n\r\n### Learning Objectives\r\n\r\nAfter completing this assignment, you should\r\n\r\n* Be familiar with Mocha, Chai, and testing concepts\r\n\r\n### Performance Objectives\r\n\r\nAfter completing this assignment, you be able to effectively use\r\n\r\n* Testing frameworks like Testem\r\n\r\n## Details\r\n\r\n### Deliverables\r\n\r\n* A fork of the repo we started in class ([5.3-tooter](https://github.com/TIY-GVL-FEE-2015-August/5.3-tooter))\r\n\r\n### Requirements\r\n\r\n1. Find the class demo repository at https://github.com/TIY-GVL-FEE-2015-August/5.3-tooter\r\n2. Fork the repository, or clone the repository and delete the `.git` directory, or download the .zip file of the repository\r\n3. Write the tests described below:\r\n\r\n### Tasks\r\n\r\n#### Easy Mode\r\n- [ ] Create the file `tests/create-test.js`\r\n- [ ] Add the line `var expect = chai.expect;` at the top of the test file\r\n- [ ] Write a `describe` block for \"create post form\"\r\n- [ ] Write an empty test in the describe block:\r\n    ```\r\n    it('should trigger a create:post event on the document with the title and body');\r\n    ```\r\n- [ ] Write the body of the test. It should include:\r\n  - [ ] Create an event listener on the `document` element for the `create:post` event. The event listener function should have an expectation (i.e. `expect(...).to...`) that expects an object with a title and body. Then the function should call `done()`\r\n  - [ ] Use jQuery to put text in the form inputs (even though they don't exist yet). Hint: Use `$('.input-class-name').val(\"Title\")`\r\n  - [ ] Use jQuery to click the form button (even though it doesn't exist yet).\r\n\r\n  You should now have a failing test :yey:.\r\n\r\n  - [ ] Write the form and inputs into the `app/templates/application.hbs`\r\n  - [ ] Write an event listener for the form's `submit` event in `app/scripts/main.js` that triggers a `create:post` event on the `document` element with a parameter that is an object with a title and body that are statically coded (e.g. `.trigger('create:post', [{title: \"Cool\", body: \"Cool\"}])`).\r\n\r\n  You should now have a passing test :yey:.\r\n\r\n#### Normal Mode\r\n  - Write a test, and implementation code, that asserts that the title and body passed to `create:post` are the actual title and body that have been typed in the form.\r\n\r\n#### Hard Mode\r\n- [ ] Write a `describe` block for \"Post.create\"\r\n- [ ] Write two empty tests in the describe block:\r\n  - [ ] `it('should send a POST request')`\r\n  - [ ] `it('should resolve with a created post, including an _id')`\r\n- [ ] Implement these tests\r\n- [ ] Implement the code that makes these tests pass\r\n\r\n## Resources\r\n### Writing Testable JavaScript\r\n- https://www.youtube.com/watch?v=OzjogCFO4Zo\r\n- https://speakerdeck.com/rmurphey/writing-testable-javascript\r\n- http://alistapart.com/article/writing-testable-javascript\r\n\r\n### Magic Tricks of Testing\r\n- https://speakerdeck.com/skmetz/magic-tricks-of-testing-railsconf\r\n- https://www.youtube.com/watch?v=URSWYvyc42M"}}