Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jasmine tests to help document features #16

Open
daguar opened this issue Jun 11, 2013 · 5 comments
Open

Add Jasmine tests to help document features #16

daguar opened this issue Jun 11, 2013 · 5 comments

Comments

@daguar
Copy link

daguar commented Jun 11, 2013

Jasmine is a nice little Javascript behavior-testing framework (similar to RSpec in Ruby) that lets you describe your code in very human-readable terms.

http://pivotal.github.io/jasmine/

Given a lot of the structure of issues I've seen so far, I think it'd be a great enhancement to add tests that cover these features using Jasmine.

@louh
Copy link
Member

louh commented Jun 13, 2013

+1. I'll look into it.

@ycombinator
Copy link
Member

FWIW, we used Jasmine for our original Louisville project. Feel free to reference and steal from https://github.com/codeforamerica/hermes-be/tree/master/spec/lib.

Shaunak

@louh
Copy link
Member

louh commented Jun 15, 2013

Do I want to use this? https://github.com/mhevery/jasmine-node

I may need some help with figuring out how you get it to test against the server.

@ycombinator
Copy link
Member

Correct. Specifically:

  • In the package.json file, add a section that looks like this:
"devDependencies": {
  "jasmine-node": "1.8.x"
}

(You might want to check the latest major version of jasmine-node on http://npmjs.org at the time of actually working on this issue).

This says that only in development environments (such as your laptop), download and install jasmine-node as a dependency of this project whenever npm install is run.

  • Then, create a folder named spec in the base directory of your project and add your test files to it. Make sure to end your test filenames in .spec.js or else Jasmine won't detect them as test files.
  • Finally, to run the tests, run this from the base directory of your project: jasmine-node spec.

Hope that helps. Let me know if you more questions.

@louh
Copy link
Member

louh commented Jun 16, 2013

Thanks @ycombinator. That definitely got me started. I've got a basic suite of tests up there at https://github.com/louh/naics-api/blob/master/spec/query.spec.js, that definitely doesn't cover all the possible results but I think it's a good enough start and to make sure I'm not doing anything wrong. There's also a test in there that was deliberately meant to fail because it's functionality that should be present but isn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants