codeforamerica / naics-api

Basic API to return NAICS codes and information
BSD 3-Clause "New" or "Revised" License
97 stars 55 forks source link

Add Jasmine tests to help document features #16

Open daguar opened 11 years ago

daguar commented 11 years ago

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 commented 11 years ago

+1. I'll look into it.

ycombinator commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

Correct. Specifically:

"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.

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

louh commented 11 years ago

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.