Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added token(s) retrieval function + tests + makefile for tests

  • Loading branch information...
commit 33e9f80711df2273d8624525da6eca7884a18de0 1 parent 2c066f1
@lyaunzbe authored
Showing with 57,563 additions and 47 deletions.
  1. +16 −0 Makefile
  2. +4 −0 config/config.js
  3. +81 −47 index.js
  4. +1 −0  node_modules/.bin/_mocha
  5. +1 −0  node_modules/.bin/mocha
  6. +9 −0 node_modules/chai/.npmignore
  7. +680 −0 node_modules/chai/History.md
  8. +62 −0 node_modules/chai/README.md
  9. +3,809 −0 node_modules/chai/chai.js
  10. +1 −0  node_modules/chai/index.js
  11. +79 −0 node_modules/chai/lib/chai.js
  12. +117 −0 node_modules/chai/lib/chai/assertion.js
  13. +1,195 −0 node_modules/chai/lib/chai/core/assertions.js
  14. +60 −0 node_modules/chai/lib/chai/error.js
  15. +986 −0 node_modules/chai/lib/chai/interface/assert.js
  16. +12 −0 node_modules/chai/lib/chai/interface/expect.js
  17. +76 −0 node_modules/chai/lib/chai/interface/should.js
  18. +70 −0 node_modules/chai/lib/chai/utils/addChainableMethod.js
  19. +37 −0 node_modules/chai/lib/chai/utils/addMethod.js
  20. +40 −0 node_modules/chai/lib/chai/utils/addProperty.js
  21. +122 −0 node_modules/chai/lib/chai/utils/eql.js
  22. +32 −0 node_modules/chai/lib/chai/utils/flag.js
  23. +19 −0 node_modules/chai/lib/chai/utils/getActual.js
  24. +49 −0 node_modules/chai/lib/chai/utils/getMessage.js
  25. +20 −0 node_modules/chai/lib/chai/utils/getName.js
  26. +102 −0 node_modules/chai/lib/chai/utils/getPathValue.js
  27. +102 −0 node_modules/chai/lib/chai/utils/index.js
  28. +314 −0 node_modules/chai/lib/chai/utils/inspect.js
  29. +44 −0 node_modules/chai/lib/chai/utils/objDisplay.js
  30. +51 −0 node_modules/chai/lib/chai/utils/overwriteMethod.js
  31. +54 −0 node_modules/chai/lib/chai/utils/overwriteProperty.js
  32. +26 −0 node_modules/chai/lib/chai/utils/test.js
  33. +44 −0 node_modules/chai/lib/chai/utils/transferFlags.js
  34. +59 −0 node_modules/chai/package.json
  35. +6 −0 node_modules/mocha/.npmignore
  36. +5 −0 node_modules/mocha/.travis.yml
  37. +490 −0 node_modules/mocha/History.md
  38. +22 −0 node_modules/mocha/LICENSE
  39. +126 −0 node_modules/mocha/Makefile
  40. +36 −0 node_modules/mocha/Readme.md
  41. +4,897 −0 node_modules/mocha/_mocha.js
  42. +422 −0 node_modules/mocha/bin/_mocha
  43. +47 −0 node_modules/mocha/bin/mocha
  44. BIN  node_modules/mocha/images/error.png
  45. BIN  node_modules/mocha/images/ok.png
  46. +4 −0 node_modules/mocha/index.js
  47. +6 −0 node_modules/mocha/lib/browser/debug.js
  48. 0  node_modules/mocha/lib/browser/diff.js
  49. +178 −0 node_modules/mocha/lib/browser/events.js
  50. 0  node_modules/mocha/lib/browser/fs.js
  51. 0  node_modules/mocha/lib/browser/path.js
  52. +125 −0 node_modules/mocha/lib/browser/progress.js
  53. +8 −0 node_modules/mocha/lib/browser/tty.js
  54. +69 −0 node_modules/mocha/lib/context.js
  55. +50 −0 node_modules/mocha/lib/hook.js
  56. +133 −0 node_modules/mocha/lib/interfaces/bdd.js
  57. +60 −0 node_modules/mocha/lib/interfaces/exports.js
  58. +5 −0 node_modules/mocha/lib/interfaces/index.js
  59. +91 −0 node_modules/mocha/lib/interfaces/qunit.js
  60. +123 −0 node_modules/mocha/lib/interfaces/tdd.js
  61. +301 −0 node_modules/mocha/lib/mocha.js
  62. +81 −0 node_modules/mocha/lib/ms.js
  63. +381 −0 node_modules/mocha/lib/reporters/base.js
  64. +56 −0 node_modules/mocha/lib/reporters/doc.js
  65. +62 −0 node_modules/mocha/lib/reporters/dot.js
  66. +51 −0 node_modules/mocha/lib/reporters/html-cov.js
  67. +255 −0 node_modules/mocha/lib/reporters/html.js
  68. +19 −0 node_modules/mocha/lib/reporters/index.js
  69. +153 −0 node_modules/mocha/lib/reporters/json-cov.js
  70. +61 −0 node_modules/mocha/lib/reporters/json-stream.js
  71. +70 −0 node_modules/mocha/lib/reporters/json.js
  72. +97 −0 node_modules/mocha/lib/reporters/landing.js
  73. +64 −0 node_modules/mocha/lib/reporters/list.js
  74. +92 −0 node_modules/mocha/lib/reporters/markdown.js
  75. +38 −0 node_modules/mocha/lib/reporters/min.js
  76. +259 −0 node_modules/mocha/lib/reporters/nyan.js
  77. +86 −0 node_modules/mocha/lib/reporters/progress.js
  78. +87 −0 node_modules/mocha/lib/reporters/spec.js
  79. +73 −0 node_modules/mocha/lib/reporters/tap.js
  80. +65 −0 node_modules/mocha/lib/reporters/teamcity.js
  81. +50 −0 node_modules/mocha/lib/reporters/templates/coverage.jade
  82. +13 −0 node_modules/mocha/lib/reporters/templates/menu.jade
  83. +34 −0 node_modules/mocha/lib/reporters/templates/script.html
  84. +307 −0 node_modules/mocha/lib/reporters/templates/style.html
  85. +115 −0 node_modules/mocha/lib/reporters/xunit.js
  86. +219 −0 node_modules/mocha/lib/runnable.js
  87. +533 −0 node_modules/mocha/lib/runner.js
  88. +296 −0 node_modules/mocha/lib/suite.js
  89. +17 −0 node_modules/mocha/lib/template.html
  90. +32 −0 node_modules/mocha/lib/test.js
  91. +282 −0 node_modules/mocha/lib/utils.js
  92. +227 −0 node_modules/mocha/mocha.css
  93. +5,013 −0 node_modules/mocha/mocha.js
  94. +1 −0  node_modules/mocha/node_modules/.bin/jade
  95. +4 −0 node_modules/mocha/node_modules/commander/.npmignore
  96. +4 −0 node_modules/mocha/node_modules/commander/.travis.yml
  97. +107 −0 node_modules/mocha/node_modules/commander/History.md
  98. +7 −0 node_modules/mocha/node_modules/commander/Makefile
  99. +262 −0 node_modules/mocha/node_modules/commander/Readme.md
  100. +2 −0  node_modules/mocha/node_modules/commander/index.js
  101. +1,026 −0 node_modules/mocha/node_modules/commander/lib/commander.js
  102. +34 −0 node_modules/mocha/node_modules/commander/package.json
  103. +4 −0 node_modules/mocha/node_modules/debug/.npmignore
  104. +47 −0 node_modules/mocha/node_modules/debug/History.md
  105. +4 −0 node_modules/mocha/node_modules/debug/Makefile
  106. +130 −0 node_modules/mocha/node_modules/debug/Readme.md
  107. +120 −0 node_modules/mocha/node_modules/debug/debug.component.js
  108. +116 −0 node_modules/mocha/node_modules/debug/debug.js
  109. +19 −0 node_modules/mocha/node_modules/debug/example/app.js
  110. +24 −0 node_modules/mocha/node_modules/debug/example/browser.html
  111. +10 −0 node_modules/mocha/node_modules/debug/example/wildcards.js
  112. +22 −0 node_modules/mocha/node_modules/debug/example/worker.js
  113. +1 −0  node_modules/mocha/node_modules/debug/head.js
  114. +2 −0  node_modules/mocha/node_modules/debug/index.js
  115. +135 −0 node_modules/mocha/node_modules/debug/lib/debug.js
  116. +31 −0 node_modules/mocha/node_modules/debug/package.json
  117. +4 −0 node_modules/mocha/node_modules/debug/tail.js
  118. +31 −0 node_modules/mocha/node_modules/diff/LICENSE
  119. +94 −0 node_modules/mocha/node_modules/diff/README.md
  120. +287 −0 node_modules/mocha/node_modules/diff/diff.js
  121. +89 −0 node_modules/mocha/node_modules/diff/index.html
  122. +42 −0 node_modules/mocha/node_modules/diff/package.json
  123. +81 −0 node_modules/mocha/node_modules/diff/style.css
  124. +616 −0 node_modules/mocha/node_modules/diff/test/diffTest.js
  125. +58 −0 node_modules/mocha/node_modules/growl/History.md
  126. +99 −0 node_modules/mocha/node_modules/growl/Readme.md
  127. +232 −0 node_modules/mocha/node_modules/growl/lib/growl.js
  128. +13 −0 node_modules/mocha/node_modules/growl/package.json
  129. +20 −0 node_modules/mocha/node_modules/growl/test.js
  130. +15 −0 node_modules/mocha/node_modules/jade/.npmignore
  131. +22 −0 node_modules/mocha/node_modules/jade/LICENSE
  132. +147 −0 node_modules/mocha/node_modules/jade/bin/jade
  133. +4 −0 node_modules/mocha/node_modules/jade/index.js
  134. +3,586 −0 node_modules/mocha/node_modules/jade/jade.js
  135. +510 −0 node_modules/mocha/node_modules/jade/jade.md
  136. +2 −0  node_modules/mocha/node_modules/jade/jade.min.js
  137. +642 −0 node_modules/mocha/node_modules/jade/lib/compiler.js
  138. +18 −0 node_modules/mocha/node_modules/jade/lib/doctypes.js
  139. +97 −0 node_modules/mocha/node_modules/jade/lib/filters.js
  140. +28 −0 node_modules/mocha/node_modules/jade/lib/inline-tags.js
  141. +237 −0 node_modules/mocha/node_modules/jade/lib/jade.js
  142. +771 −0 node_modules/mocha/node_modules/jade/lib/lexer.js
  143. +77 −0 node_modules/mocha/node_modules/jade/lib/nodes/attrs.js
  144. +33 −0 node_modules/mocha/node_modules/jade/lib/nodes/block-comment.js
  145. +121 −0 node_modules/mocha/node_modules/jade/lib/nodes/block.js
  146. +43 −0 node_modules/mocha/node_modules/jade/lib/nodes/case.js
  147. +35 −0 node_modules/mocha/node_modules/jade/lib/nodes/code.js
  148. +32 −0 node_modules/mocha/node_modules/jade/lib/nodes/comment.js
  149. +29 −0 node_modules/mocha/node_modules/jade/lib/nodes/doctype.js
  150. +35 −0 node_modules/mocha/node_modules/jade/lib/nodes/each.js
  151. +35 −0 node_modules/mocha/node_modules/jade/lib/nodes/filter.js
  152. +20 −0 node_modules/mocha/node_modules/jade/lib/nodes/index.js
  153. +32 −0 node_modules/mocha/node_modules/jade/lib/nodes/literal.js
  154. +36 −0 node_modules/mocha/node_modules/jade/lib/nodes/mixin.js
  155. +25 −0 node_modules/mocha/node_modules/jade/lib/nodes/node.js
  156. +95 −0 node_modules/mocha/node_modules/jade/lib/nodes/tag.js
  157. +36 −0 node_modules/mocha/node_modules/jade/lib/nodes/text.js
  158. +710 −0 node_modules/mocha/node_modules/jade/lib/parser.js
  159. +174 −0 node_modules/mocha/node_modules/jade/lib/runtime.js
  160. +19 −0 node_modules/mocha/node_modules/jade/lib/self-closing.js
  161. +49 −0 node_modules/mocha/node_modules/jade/lib/utils.js
  162. +2 −0  node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.orig
  163. +5 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/.gitignore.rej
  164. +2 −0  node_modules/mocha/node_modules/jade/node_modules/mkdirp/.npmignore
  165. +21 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/LICENSE
  166. +54 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/README.markdown
  167. +6 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/examples/pow.js
  168. +6 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/examples/pow.js.orig
  169. +19 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/examples/pow.js.rej
  170. +79 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/index.js
  171. +32 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json
  172. +38 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/chmod.js
  173. +37 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/clobber.js
  174. +28 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/mkdirp.js
  175. +32 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/perm.js
  176. +39 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/perm_sync.js
  177. +41 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/race.js
  178. +32 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/rel.js
  179. +27 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/sync.js
  180. +28 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/umask.js
  181. +27 −0 node_modules/mocha/node_modules/jade/node_modules/mkdirp/test/umask_sync.js
  182. +44 −0 node_modules/mocha/node_modules/jade/package.json
  183. +179 −0 node_modules/mocha/node_modules/jade/runtime.js
  184. +1 −0  node_modules/mocha/node_modules/jade/runtime.min.js
  185. +7 −0 node_modules/mocha/node_modules/jade/test.jade
  186. +5 −0 node_modules/mocha/node_modules/jade/testing/head.jade
  187. +22 −0 node_modules/mocha/node_modules/jade/testing/index.jade
  188. +11 −0 node_modules/mocha/node_modules/jade/testing/index.js
  189. +6 −0 node_modules/mocha/node_modules/jade/testing/layout.jade
  190. +7 −0 node_modules/mocha/node_modules/jade/testing/user.jade
  191. +27 −0 node_modules/mocha/node_modules/jade/testing/user.js
  192. +2 −0  node_modules/mocha/node_modules/mkdirp/.gitignore.orig
  193. +5 −0 node_modules/mocha/node_modules/mkdirp/.gitignore.rej
  194. +2 −0  node_modules/mocha/node_modules/mkdirp/.npmignore
  195. +4 −0 node_modules/mocha/node_modules/mkdirp/.travis.yml
  196. +21 −0 node_modules/mocha/node_modules/mkdirp/LICENSE
  197. +61 −0 node_modules/mocha/node_modules/mkdirp/README.markdown
  198. +6 −0 node_modules/mocha/node_modules/mkdirp/examples/pow.js
  199. +6 −0 node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig
  200. +19 −0 node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej
  201. +94 −0 node_modules/mocha/node_modules/mkdirp/index.js
  202. +32 −0 node_modules/mocha/node_modules/mkdirp/package.json
  203. +38 −0 node_modules/mocha/node_modules/mkdirp/test/chmod.js
  204. +37 −0 node_modules/mocha/node_modules/mkdirp/test/clobber.js
  205. +28 −0 node_modules/mocha/node_modules/mkdirp/test/mkdirp.js
  206. +32 −0 node_modules/mocha/node_modules/mkdirp/test/perm.js
  207. +39 −0 node_modules/mocha/node_modules/mkdirp/test/perm_sync.js
  208. +41 −0 node_modules/mocha/node_modules/mkdirp/test/race.js
  209. +32 −0 node_modules/mocha/node_modules/mkdirp/test/rel.js
  210. +25 −0 node_modules/mocha/node_modules/mkdirp/test/return.js
  211. +24 −0 node_modules/mocha/node_modules/mkdirp/test/return_sync.js
  212. +18 −0 node_modules/mocha/node_modules/mkdirp/test/root.js
  213. +32 −0 node_modules/mocha/node_modules/mkdirp/test/sync.js
  214. +28 −0 node_modules/mocha/node_modules/mkdirp/test/umask.js
  215. +32 −0 node_modules/mocha/node_modules/mkdirp/test/umask_sync.js
  216. +1 −0  node_modules/mocha/node_modules/ms/.npmignore
  217. +21 −0 node_modules/mocha/node_modules/ms/History.md
  218. +8 −0 node_modules/mocha/node_modules/ms/Makefile
  219. +24 −0 node_modules/mocha/node_modules/ms/README.md
  220. +7 −0 node_modules/mocha/node_modules/ms/component.json
  221. +81 −0 node_modules/mocha/node_modules/ms/ms.js
  222. +14 −0 node_modules/mocha/node_modules/ms/package.json
  223. +19 −0 node_modules/mocha/node_modules/ms/test/index.html
  224. +9,266 −0 node_modules/mocha/node_modules/ms/test/support/jquery.js
  225. +85 −0 node_modules/mocha/node_modules/ms/test/test.js
  226. +46 −0 node_modules/mocha/package.json
  227. +38 −0 node_modules/mocha/test.js
  228. +55 −0 node_modules/request/LICENSE
  229. +310 −0 node_modules/request/README.md
  230. +191 −0 node_modules/request/aws.js
  231. +103 −0 node_modules/request/forever.js
  232. +1,123 −0 node_modules/request/main.js
  233. +5 −0 node_modules/request/node_modules/form-data/.npmignore
  234. +7 −0 node_modules/request/node_modules/form-data/Makefile
  235. +86 −0 node_modules/request/node_modules/form-data/Readme.md
  236. +237 −0 node_modules/request/node_modules/form-data/lib/form_data.js
  237. +8 −0 node_modules/request/node_modules/form-data/node-form-data.sublime-project
  238. +508 −0 node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
  239. +9 −0 node_modules/request/node_modules/form-data/node_modules/async/.gitmodules
  240. +19 −0 node_modules/request/node_modules/form-data/node_modules/async/LICENSE
  241. +21 −0 node_modules/request/node_modules/form-data/node_modules/async/Makefile
  242. +970 −0 node_modules/request/node_modules/form-data/node_modules/async/README.md
  243. BIN  node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip
  244. +70 −0 node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css
  245. +1,966 −0 node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js
  246. +1 −0  node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
  247. +3 −0  node_modules/request/node_modules/form-data/node_modules/async/index.js
  248. +632 −0 node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
  249. +4 −0 node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg
  250. +41 −0 node_modules/request/node_modules/form-data/node_modules/async/package.json
  251. BIN  node_modules/request/node_modules/form-data/node_modules/async/test/.swp
  252. +1,367 −0 node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js
  253. +24 −0 node_modules/request/node_modules/form-data/node_modules/async/test/test.html
  254. +3 −0  node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore
  255. +19 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/License
  256. +7 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile
  257. +132 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md
  258. +183 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js
  259. +2 −0  ..._modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore
  260. +19 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License
  261. +7 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile
  262. +154 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md
  263. +99 −0 ...quest/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js
  264. +38 −0 ...odules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
  265. +6 −0 ...ules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js
  266. +38 −0 ...-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
  267. +21 −0 ...node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
  268. +14 −0 ...data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
  269. +48 −0 .../form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js
  270. +15 −0 ...data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
  271. +18 −0 ...s/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js
  272. +13 −0 ...es/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
  273. +13 −0 .../form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js
  274. +7 −0 ...modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js
  275. +39 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
  276. +12 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js
  277. +256 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt
  278. +256 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt
  279. +27 −0 ...dules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js
  280. +34 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js
  281. +38 −0 ...les/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js
  282. +35 −0 ...odules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js
  283. +24 −0 ..._modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js
  284. +30 −0 ...dules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js
  285. +7 −0 node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js
  286. +43 −0 node_modules/request/node_modules/form-data/package.json
  287. +14 −0 node_modules/request/node_modules/form-data/test/common.js
  288. +1 −0  node_modules/request/node_modules/form-data/test/fixture/bacon.txt
  289. BIN  node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg
  290. +93 −0 node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js
  291. +18 −0 node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js
  292. +121 −0 node_modules/request/node_modules/form-data/test/integration/test-http-response.js
  293. +111 −0 node_modules/request/node_modules/form-data/test/integration/test-pipe.js
  294. +107 −0 node_modules/request/node_modules/form-data/test/integration/test-submit.js
  295. +7 −0 node_modules/request/node_modules/form-data/test/run.js
  296. +19 −0 node_modules/request/node_modules/mime/LICENSE
  297. +63 −0 node_modules/request/node_modules/mime/README.md
  298. +104 −0 node_modules/request/node_modules/mime/mime.js
  299. +42 −0 node_modules/request/node_modules/mime/package.json
  300. +55 −0 node_modules/request/node_modules/mime/test.js
Sorry, we could not display the entire diff because too many files (354) changed.
View
16 Makefile
@@ -0,0 +1,16 @@
+REPORTER = spec
+
+test:
+ @NODE_ENV=test mocha \
+ --reporter $(REPORTER) \
+ --timeout 8000
+
+test-w:
+ @NODE_ENV=test mocha \
+ --reporter $(REPORTER) \
+ --timeout 8000 \
+ --watch
+
+
+
+.PHONY: test test-w
View
4 config/config.js
@@ -0,0 +1,4 @@
+module.exports = {
+ "client_secret" : "ZYUifIK5crKoqNIDiOkAAZaz",
+ "client_id" : "532620919617.apps.googleusercontent.com"
+};
View
128 index.js
@@ -2,52 +2,86 @@ var request = require('request'),
exec = require('child_process').exec,
querystring = require('querystring');
-var events = require('events');
-
module.exports = function(opts) {
- if(!opts.redirect_uri){
- opts.redirect_uri = 'http://localhost:3000/callback';
- }
-
- var gAuth = {};
-
- var endpoint = 'https://accounts.google.com/o/oauth2/auth';
-
- function getAuthCode(callback){
- var qs = {
- response_type: 'code',
- client_id: opts.client_id,
- redirect_uri: opts.redirect_uri,
- scope: 'https://www.googleapis.com/auth/userinfo.profile'
- };
-
- var url = '\''+endpoint + '?' + querystring.stringify(qs) +'\'';
-
- exec('open '+url, function(err){
- if(err !== null){
- console.log(err);
- }
- });
-
- var server = require('http').createServer(function(req, res) {
- if(req.url.match(/callback/)) return parseCode(req, res)
- }).listen(3000);
-
- function parseCode(req,res){
- //for gdrive-cli:
- //instead of just closing the connection, redirect to an informational page
- server.close();
-
- //split url by ? so we just have the querystring left
- //extract out the auth code
- callback(querystring.parse(req.url.split('?')[1])['code']);
- }
- }
-
- gAuth.getAuthCode = getAuthCode;
-
- gAuth.
-
- return gAuth;
-};
+ if(!opts.redirect_uri){
+ opts.redirect_uri = 'http://localhost:3000/callback';
+ }
+
+ var gAuth = {};
+
+ var endpoint = 'https://accounts.google.com/o/oauth2/auth';
+
+ /**
+ * Constructs a google OAuth2 request url using the provided opts.
+ * Spawns an http server to handle the redirect. Once user authenticates
+ * and the server parses the auth code, the server process is closed
+ * (Assuming the user has closed the window. For future, add redirect after
+ * authentication to a page with instructions to close tab/window).
+ */
+ function getAuthCode(callback){
+ var qs = {
+ response_type: 'code',
+ client_id: opts.client_id,
+ redirect_uri: opts.redirect_uri,
+ scope: 'https://www.googleapis.com/auth/userinfo.profile'
+ };
+
+ var uri = '\''+endpoint + '?' + querystring.stringify(qs) +'\'';
+
+ exec('open '+uri, function(err){
+ if(err !== null){
+ callback(err);
+ }
+ var server = require('http').createServer(function(req, res) {
+ if(req.url.match(/callback/)) return parseCode(req, res)
+ }).listen(3000);
+
+ function parseCode(req,res){
+ //for gdrive-cli:
+ //instead of just closing the connection, redirect to an informational page
+ server.close();
+
+ //split url by ? so we just have the querystring left
+ //extract out the auth code
+ callback(null, querystring.parse(req.url.split('?')[1])['code']);
+ }
+
+ });
+ }
+
+ /**
+ * Given the acquired authorization code and the provided opts,
+ * construct a POST request to acquire the access token and refresh
+ * token.
+ *
+ * @param {String} code The acquired authorization code
+ */
+ function getTokens(code, callback){
+ var uri = 'https://accounts.google.com/o/oauth2/token';
+ var form = {
+ code : code,
+ client_id : opts.client_id,
+ client_secret: opts.client_secret,
+ redirect_uri: opts.redirect_uri,
+ grant_type: 'authorization_code'
+ };
+
+ request.post({url:uri, form: form}, function(err,req, body){
+ if(err !== null){
+ callback(err);
+ }else{
+ callback(null, JSON.parse(body));
+ }
+ });
+ }
+
+ gAuth.getAuthCode = getAuthCode;
+
+ gAuth.getTokens = getTokens;
+
+ //gAuth.refreshToken = refreshToken;
+
+ return gAuth;
+
+};
View
1  node_modules/.bin/_mocha
View
1  node_modules/.bin/mocha
View
9 node_modules/chai/.npmignore
@@ -0,0 +1,9 @@
+.git*
+support/
+test/
+.DS_Store
+coverage.html
+lib-cov
+.travis.yml
+Makefile
+.mailmap
View
680 node_modules/chai/History.md
@@ -0,0 +1,680 @@
+
+1.4.2 / 2012-12-21
+==================
+
+ * browser build: (object diff support when used with mocha) #106
+ * test: [display] array test for mocha object diff
+ * browser: no longer need different AssertionError constructor
+
+1.4.1 / 2012-12-21
+==================
+
+ * showDiff: force diff for equal and eql. #106
+ * test: [expect] type null. #122
+ * Merge pull request #115 from eshao/fix-assert-Throw
+ * FIX: assert.Throw checks error type/message
+ * TST: assert.Throw should check error type/message
+
+1.4.0 / 2012-11-29
+==================
+
+ * pre-release browser build
+ * clean up index.js to not check for cov, revert package.json to use index.js
+ * convert tests to use new bootstrap
+ * refactor testing bootstrap
+ * use spaces (not tabs). Clean up #114
+ * Merge pull request #114 from trantorLiu/master
+ * Add most() (alias: lte) and least() (alias: gte) to the API with new chainers "at" and "of".
+ * Change `main` to ./lib/chai. Fixes #28.
+ * Merge pull request #104 from connec/deep_equals_circular_references_
+ * Merge pull request #109 from nnarhinen/patch-1
+ * Check for 'actual' type
+ * Added support for circular references when checking deep (in)equality.
+
+1.3.0 / 2012-10-01
+==================
+
+ * browser build w/ folio >= 0.3.4. Closes #99
+ * add back buffer test for deep equal
+ * do not write flags to assertion.prototype
+ * remove buffer test from expect
+ * browser build
+ * improve documentation of custom error messages
+ * Merge branch 'master' of git://github.com/Liffft/chai into Liffft-master
+ * browser build
+ * improved buffer deep equal checking
+ * mocha is npm test command
+ * Cleaning up the js style…
+ * expect tests now include message pass-through
+ * packaging up browser-side changes…
+ * Increasing Throws error message verbosity
+ * Should syntax: piping message through
+ * Make globalShould test work in browser too.
+ * Add a setter for `Object.prototype.should`. Closes #86.
+
+1.2.0 / 2012-08-07
+==================
+
+ * Merge branch 'feature/errmsg'
+ * browser build
+ * comment updates for utilities
+ * tweak objDislay to only kick in if object inspection is too long
+ * Merge branch 'master' into feature/errmsg
+ * add display sample for error message refactor
+ * first draft of error message refactor. #93
+ * add `closeTo` assertion to `assert` interface. Closes #89.
+ * update folio build for better require.js handling. Closes #85
+ * Merge pull request #92 from paulmillr/topics/add-dom-checks
+ * Add check for DOM objects.
+ * browser build
+ * Merge branch 'master' of github.com:chaijs/chai
+ * bug - getActual not defaulting to assertion subject
+ * Merge pull request #88 from pwnall/master
+ * Don't inspect() assertion arguments if the assertion passes.
+
+1.1.1 / 2012-07-09
+==================
+
+ * improve commonjs support on browser build
+ * Merge pull request #83 from tkazec/equals
+ * Document .equals
+ * Add .equals as an alias of .equal
+ * remove unused browser prefix/suffix
+ * Merge branch 'feature/folio-build'
+ * browser build
+ * using folio to compile
+ * clean up makefile
+ * early folio 0.3.x support
+
+1.1.0 / 2012-06-26
+==================
+
+ * browser build
+ * Disable "Assertion.includeStack is false" test in IE.
+ * Use `utils.getName` for all function inspections.
+ * Merge pull request #80 from kilianc/closeTo
+ * fixes #79
+ * browser build
+ * expand docs to indicate change of subject for chaining. Closes #78
+ * add `that` chain noop
+ * Merge branch 'bug/74'
+ * comments on how to property use `length` as chain. Closes #74
+ * tests for length as chainable property. #74
+ * add support for `length` as chainable prop/method.
+ * Merge branch 'bug/77'
+ * tests for getPathValue when working with nested arrays. Closes #77
+ * add getPathValue support for nested arrays
+ * browser build
+ * fix bug for missing browser utils
+ * compile tool aware of new folder layout
+ * Merge branch 'refactor/1dot1'
+ * move core assertions to own file and refactor all using utils
+ * rearrange folder structure
+
+1.0.4 / 2012-06-03
+==================
+
+ * Merge pull request #68 from fizker/itself
+ * Added itself chain.
+ * simplify error inspections for cross browser compatibility
+ * fix safari `addChainableMethod` errors. Closes #69
+
+1.0.3 / 2012-05-27
+==================
+
+ * Point Travis badge to the right place.
+ * Make error message for eql/deep.equal more clear.
+ * Fix .not.deep.equal.
+ * contributors list
+
+1.0.2 / 2012-05-26
+==================
+
+ * Merge pull request #67 from chaijs/chaining-and-flags
+ * Browser build.
+ * Use `addChainableMethod` to get away from `__proto__` manipulation.
+ * New `addChainableMethod` utility.
+ * Replace `getAllFlags` with `transferFlags` utility.
+ * browser build
+ * test - get all flags
+ * utility - get all flags
+ * Add .mailmap to .npmignore.
+ * Add a .mailmap file to fix my name in shortlogs.
+
+1.0.1 / 2012-05-18
+==================
+
+ * browser build
+ * Fixing "an" vs. "a" grammar in type assertions.
+ * Uniformize `assert` interface inline docs.
+ * Don't use `instanceof` for `assert.isArray`.
+ * Add `deep` flag for equality and property value.
+ * Merge pull request #64 from chaijs/assertion-docs
+ * Uniformize assertion inline docs.
+ * Add npm-debug.log to .gitignore.
+ * no reserved words as actuals. #62
+
+1.0.0 / 2012-05-15
+==================
+
+ * readme cleanup
+ * browser build
+ * utility comments
+ * removed docs
+ * update to package.json
+ * docs build
+ * comments / docs updates
+ * plugins app cleanup
+ * Merge pull request #61 from joliss/doc
+ * Fix and improve documentation of assert.equal and friends
+ * browser build
+ * doc checkpoint - texture
+ * Update chai-jquery link
+ * Use defined return value of Assertion extension functions
+ * Update utility docs
+
+1.0.0-rc3 / 2012-05-09
+==================
+
+ * Merge branch 'feature/rc3'
+ * docs update
+ * browser build
+ * assert test conformity for minor refactor api
+ * assert minor refactor
+ * update util tests for new add/overwrite prop/method format
+ * added chai.Assertion.add/overwrite prop/method for plugin toolbox
+ * add/overwrite prop/method don't make assumptions about context
+ * doc test suite
+ * docs don't need coverage
+ * refactor all simple chains into one forEach loop, for clean documentation
+ * updated npm ignore
+ * remove old docs
+ * docs checkpoint - guide styled
+ * Merge pull request #59 from joliss/doc
+ * Document how to run the test suite
+ * don't need to rebuild docs to view
+ * dep update
+ * docs checkpoint - api section
+ * comment updates for docs
+ * new doc site checkpoint - plugin directory!
+ * Merge pull request #57 from kossnocorp/patch-1
+ * Fix typo: devDependancies → devDependencies
+ * Using message flag in `getMessage` util instead of old `msg` property.
+ * Adding self to package.json contributors.
+ * `getMessage` shouldn't choke on null/omitted messages.
+ * `return this` not necessary in example.
+ * `return this` not necessary in example.
+ * Sinon–Chai has a dash
+ * updated plugins list for docs
+
+1.0.0-rc2 / 2012-05-06
+==================
+
+ * Merge branch 'feature/test-cov'
+ * browser build
+ * missing assert tests for ownProperty
+ * appropriate assert equivalent for expect.to.have.property(key, val)
+ * reset AssertionError to include full stack
+ * test for plugin utilities
+ * overwrite Property and Method now ensure chain
+ * version notes in readme
+
+1.0.0-rc1 / 2012-05-04
+==================
+
+ * browser build (rc1)
+ * assert match/notMatch tests
+ * assert interface - notMatch, ownProperty, notOwnProperty, ownPropertyVal, ownPropertyNotVal
+ * cleaner should interface export.
+ * added chai.Assertion.prototype._obj (getter) for quick access to object flag
+ * moved almostEqual / almostDeepEqual to stats plugin
+ * added mocha.opts
+ * Add test for `utils.addMethod`
+ * Fix a typo
+ * Add test for `utils.overwriteMethod`
+ * Fix a typo
+ * Browser build
+ * Add undefined assertion
+ * Add null assertion
+ * Fix an issue with `mocha --watch`
+ * travis no longer tests on node 0.4.x
+ * removing unnecissary carbon dep
+ * Merge branch 'feature/plugins-app'
+ * docs build
+ * templates for docs express app for plugin directory
+ * express app for plugin and static serving
+ * added web server deps
+ * Merge pull request #54 from josher19/master
+ * Remove old test.assert code
+ * Use util.inspect instead of inspect for deepAlmostEqual and almostEqual
+ * browser build
+ * Added almostEqual and deepAlmostEqual to assert test suite.
+ * bug - context determinants for utils
+ * dec=0 means rounding, so assert.deepAlmostEqual({pi: 3.1416}, {pi: 3}, 0) is true
+ * wrong travis link
+ * readme updates for version information
+ * travis tests 0.5.x branch as well
+ * [bug] util `addProperty` not correctly exporting
+ * read me version notes
+ * browser build 1.0.0alpha1
+ * not using reserved words in internal assertions. #52
+ * version tick
+ * clean up redundant tests
+ * Merge branch 'refs/heads/0.6.x'
+ * update version tag in package 1.0.0alpha1
+ * browser build
+ * added utility tests to browser specs
+ * beginning utility testing
+ * updated utility comments
+ * utility - overwriteMethod
+ * utility - overwriteProperty
+ * utility - addMethod
+ * utility - addProperty
+ * missing ;
+ * contributors list update
+ * Merge branch 'refs/heads/0.6.x-docs' into 0.6.x
+ * Added guide link to docs. WIP
+ * Include/contain are now both properties and methods
+ * Add an alias annotation
+ * Remove usless function wrapper
+ * Fix a typo
+ * A/an are now both properties and methods
+ * [docs] new site homepage layout / color checkpoint
+ * Ignore IE-specific error properties.
+ * Fixing order of error message test.
+ * New cross-browser `getName` util.
+ * Fixing up `AssertionError` inheritance.
+ * backup docs
+ * Add doctypes
+ * [bug] was still using `constructor.name` in `throw` assertion
+ * [bug] flag Object.create(null) instead of new Object
+ * [test] browser build
+ * [refactor] all usage of Assertion.prototype.assert now uses template tags and flags
+ * [refactor] remove Assertion.prototype.inspect for testable object inspection
+ * [refactor] object to test is now stored in flag, with ssfi and custom message
+ * [bug] flag util - don't return on `set`
+ * [docs] comments for getMessage utility
+ * [feature] getMessage
+ * [feature] testing utilities
+ * [refactor] flag doesn't require `call`
+ * Make order of source files well-defined
+ * Added support for throw(errorInstance).
+ * Use a foolproof method of grabbing an error's name.
+ * Removed constructor.name check from throw.
+ * disabled stackTrack configuration tests until api is stable again
+ * first version of line displayed error for node js (unstable)
+ * refactor core Assertion to use flag utility for negation
+ * added flag utility
+ * tests for assert interface negatives. Closed #42
+ * added assertion negatives that were missing. #42
+ * Support for expected and actual parameters in assert-style error object
+ * chai as promised - readme
+ * Added assert.fail. Closes #40
+ * better error message for assert.operator. Closes #39
+ * [refactor] Assertion#property to use getPathValue property
+ * added getPathValue utility helper
+ * removed todo about browser build
+ * version notes
+ * version bumb 0.6.0
+ * browser build
+ * [refactor] browser compile function to replace with `require('./error')' with 'require('./browser/error')'
+ * [feature] browser uses different error.js
+ * [refactor] error without chai.fail
+ * Assertion & interfaces use new utils helper export
+ * [refactor] primary export for new plugin util usage
+ * added util index.js helper
+ * added 2012 to copyright headers
+ * Added DeepEqual assertions
+
+0.5.3 / 2012-04-21
+==================
+
+ * Merge branch 'refs/heads/jgonera-oldbrowsers'
+ * browser build
+ * fixed reserved names for old browsers in interface/assert
+ * fixed reserved names for old browsers in interface/should
+ * fixed: chai.js no longer contains fail()
+ * fixed reserved names for old browsers in Assertion
+ * Merge pull request #49 from joliss/build-order
+ * Make order of source files well-defined
+ * Merge pull request #43 from zzen/patch-1
+ * Support for expected and actual parameters in assert-style error object
+ * chai as promised - readme
+
+0.5.2 / 2012-03-21
+==================
+
+ * browser build
+ * Merge branch 'feature/assert-fail'
+ * Added assert.fail. Closes #40
+ * Merge branch 'bug/operator-msg'
+ * better error message for assert.operator. Closes #39
+ * version notes
+
+0.5.1 / 2012-03-14
+==================
+
+ * chai.fail no longer exists
+ * Merge branch 'feature/assertdefined'
+ * Added asset#isDefined. Closes #37.
+ * dev docs update for Assertion#assert
+
+0.5.0 / 2012-03-07
+==================
+
+ * [bug] on inspect of reg on n 0.4.12
+ * Merge branch 'bug/33-throws'
+ * Merge pull request #35 from logicalparadox/empty-object
+ * browser build
+ * updated #throw docs
+ * Assertion#throw `should` tests updated
+ * Assertion#throw `expect` tests
+ * Should interface supports multiple throw parameters
+ * Update Assertion#throw to support strings and type checks.
+ * Add more tests for `empty` in `should`.
+ * Add more tests for `empty` in `expect`.
+ * Merge branch 'master' into empty-object
+ * don't switch act/exp
+ * Merge pull request #34 from logicalparadox/assert-operator
+ * Update the compiled verison.
+ * Add `assert.operator`.
+ * Notes on messages. #22
+ * browser build
+ * have been test
+ * below tests
+ * Merge branch 'feature/actexp'
+ * browser build
+ * remove unnecessary fail export
+ * full support for actual/expected where relevant
+ * Assertion.assert support expected value
+ * clean up error
+ * Update the compiled version.
+ * Add object & sane arguments support to `Assertion#empty`.
+
+0.4.2 / 2012-02-28
+==================
+
+ * fix for `process` not available in browser when used via browserify. Closes #28
+ * Merge pull request #31 from joliss/doc
+ * Document that "should" works in browsers other than IE
+ * Merge pull request #30 from logicalparadox/assert-tests
+ * Update the browser version of chai.
+ * Update `assert.doesNotThrow` test in order to check the use case when type is a string.
+ * Add test for `assert.ifError`.
+ * Falsey -> falsy.
+ * Full coverage for `assert.throws` and `assert.doesNotThrow`.
+ * Add test for `assert.doesNotThrow`.
+ * Add test for `assert.throws`.
+ * Add test for `assert.length`.
+ * Add test for `assert.include`.
+ * Add test for `assert.isBoolean`.
+ * Fix the implementation of `assert.isNumber`.
+ * Add test for `assert.isNumber`.
+ * Add test for `assert.isString`.
+ * Add test for `assert.isArray`.
+ * Add test for `assert.isUndefined`.
+ * Add test for `assert.isNotNull`.
+ * Fix `assert.isNotNull` implementation.
+ * Fix `assert.isNull` implementation.
+ * Add test for `assert.isNull`.
+ * Add test for `assert.notDeepEqual`.
+ * Add test for `assert.deepEqual`.
+ * Add test for `assert.notStrictEqual`.
+ * Add test for `assert.strictEqual`.
+ * Add test for `assert.notEqual`.
+
+0.4.1 / 2012-02-26
+==================
+
+ * Merge pull request #27 from logicalparadox/type-fix
+ * Update the browser version.
+ * Add should tests for type checks.
+ * Add function type check test.
+ * Add more type checks tests.
+ * Add test for `new Number` type check.
+ * Fix type of actual checks.
+
+0.4.0 / 2012-02-25
+==================
+
+ * docs and readme for upcoming 0.4.0
+ * docs generated
+ * putting coverage and tests for docs in docs/out/support
+ * make docs
+ * makefile copy necessary resources for tests in docs
+ * rename configuration test
+ * Merge pull request #21 from logicalparadox/close-to
+ * Update the browser version.
+ * Update `closeTo()` docs.
+ * Add `Assertion.closeTo()` method.
+ * Add `.closeTo()` should test.
+ * Add `.closeTo()` expect test.
+ * Merge pull request #20 from logicalparadox/satisfy
+ * Update the browser version.
+ * `..` -> `()` in `.satisfy()` should test.
+ * Update example for `.satisfy()`.
+ * Update the compiled browser version.
+ * Add `Assertion.satisfy()` method.
+ * Add `.satisfy()` should test.
+ * Add `.satisfy()` expect test.
+ * Merge pull request #19 from logicalparadox/respond-to
+ * Update the compiled browser version.
+ * Add `respondTo` Assertion.
+ * Add `respondTo` should test.
+ * Add `respondTo` expect test.
+ * Merge branch 'feature/coverage'
+ * mocha coverage support
+ * doc contributors
+ * README contributors
+
+0.3.4 / 2012-02-23
+==================
+
+ * inline comment typos for #15
+ * Merge branch 'refs/heads/jeffbski-configErrorStackCompat'
+ * includeStack documentation for all interfaces
+ * suite name more generic
+ * Update test to be compatible with browsers that do not support err.stack
+ * udpated compiled chai.js and added to browser tests
+ * Allow inclusion of stack trace for Assert error messages to be configurable
+ * docs sharing buttons
+ * sinon-chai link
+ * doc updates
+ * read me updates include plugins
+
+0.3.3 / 2012-02-12
+==================
+
+ * Merge pull request #14 from jfirebaugh/configurable_properties
+ * Make Assertion.prototype properties configurable
+
+0.3.2 / 2012-02-10
+==================
+
+ * codex version
+ * docs
+ * docs cleanup
+
+0.3.1 / 2012-02-07
+==================
+
+ * node 0.4.x compat
+
+0.3.0 / 2012-02-07
+==================
+
+ * Merge branch 'feature/03x'
+ * browser build
+ * remove html/json/headers testign
+ * regex error.message testing
+ * tests for using plugins
+ * Merge pull request #11 from domenic/master
+ * Make `chai.use` a no-op if the function has already been used.
+
+0.2.4 / 2012-02-02
+==================
+
+ * added in past tense switch for `been`
+
+0.2.3 / 2012-02-01
+==================
+
+ * try that again
+
+0.2.2 / 2012-02-01
+==================
+
+ * added `been` (past of `be`) alias
+
+0.2.1 / 2012-01-29
+==================
+
+ * added Throw, with a capital T, as an alias to `throw` (#7)
+
+0.2.0 / 2012-01-26
+==================
+
+ * update gitignore for vim *.swp
+ * Merge branch 'feature/plugins'
+ * browser build
+ * interfaces now work with use
+ * simple .use function. See #9.
+ * readme notice on browser compat
+
+0.1.7 / 2012-01-25
+==================
+
+ * added assert tests to browser test runner
+ * browser update
+ * `should` interface patch for primitives support in FF
+ * fix isObject() Thanks @milewise
+ * travis only on branch `master`
+ * add instanceof alias `instanceOf`. #6
+ * some tests for assert module
+
+0.1.6 / 2012-01-02
+==================
+
+ * commenting for assert interface
+ * updated codex dep
+
+0.1.5 / 2012-01-02
+==================
+
+ * browser tests pass
+ * type in should.not.equal
+ * test for should (not) exist
+ * added should.exist and should.not.exist
+ * browser uses tdd
+ * convert tests to tdd
+
+0.1.4 / 2011-12-26
+==================
+
+ * browser lib update for new assert interface compatiblitiy
+ * inspect typos
+ * added strict equal + negatives and ifError
+ * interface assert had doesNotThrow
+ * added should tests to browser
+ * new expect empty tests
+ * should test browser compat
+ * Fix typo for instanceof docs. Closes #3 [ci skip]
+
+0.1.3 / 2011-12-18
+==================
+
+ * much cleaner reporting string on error.
+
+0.1.2 / 2011-12-18
+==================
+
+ * [docs] for upcoming 0.1.2
+ * browser version built with pre/suffix … all tests passing
+ * make / compile now use prefix/suffix correctly
+ * code clean
+ * prefix/suffix to wrap browser output to prevent conflicts with other `require` methods.
+ * Merge branch 'feature/should4xcompatibility'
+ * compile for browser tests.. all pass
+ * added header/status/html/json
+ * throw tests
+ * should.throw & should.not.throw shortcuts
+ * improved `throw` type detection and messaging
+ * contain is now `include` … keys modifier is now `contain`
+ * removed object() test
+ * removed #respondTo
+ * Merge branch 'bug/2'
+ * replaced __defineGetter__ with defineProperty for all uses
+ * [docs] change mp tracking code
+ * docs site updated with assert (TDD) interface
+ * updated doc comments for assert interface
+
+0.1.1 / 2011-12-16
+==================
+
+ * docs ready for upcoming 0.1.1
+ * readme image fixed [ci skip]
+ * more readme tweaks [ci skip]
+ * réadmet image fixed [ci skip]
+ * documentation
+ * codex locked in version 0.0.5
+ * more comments to assertions for docs
+ * assertions fully commented, browser library updated
+ * adding codex as doc dependancy
+ * prepping for docs
+ * assertion component completely commented for documentation
+ * added exist test
+ * var expect outside of browser if check
+ * added keywords to package.json
+
+0.1.0 / 2011-12-15
+==================
+
+ * failing on purpose successful .. back to normal
+ * testing travis failure
+ * assert#arguments getter
+ * readme typo
+ * updated README
+ * added travis and npmignore
+ * copyright notices … think i got them all
+ * moved expect interface to own file for consistency
+ * assert ui deepEqual
+ * browser tests expect (all working)
+ * browser version built
+ * chai.fail (should ui)
+ * expect tests browser compatible
+ * tests for should and expect (all pass)
+ * moved fail to primary export
+ * should compatibility testing
+ * within, greaterThan, object, keys,
+ * Aliases
+ * Assertion#property now correctly works with negate and undefined values
+ * error message language matches should
+ * Assertion#respondTo
+ * Assertion now uses inspect util
+ * git ignore node modules
+ * should is exported
+ * AssertionError __proto__ from Error.prototype
+ * add should interface for should.js compatibility
+ * moved eql to until folder and added inspect from (joyent/node)
+ * added mocha for testing
+ * browser build for current api
+ * multiple .property assertions
+ * added deep equal from node
+
+0.0.2 / 2011-12-07
+==================
+
+ * cleaner output on error
+ * improved exists detection
+ * package remnant artifact
+ * empty deep equal
+ * test browser build
+ * assertion cleanup
+ * client compile script
+ * makefile
+ * most of the basic assertions
+ * allow no parameters to assertion error
+ * name change
+ * assertion error instance
+ * main exports: assert() & expect()
+ * initialize
View
62 node_modules/chai/README.md
@@ -0,0 +1,62 @@
+[![Build Status](https://secure.travis-ci.org/chaijs/chai.png)](http://travis-ci.org/chaijs/chai)
+
+[![Chai Documentation](http://chaijs.com/public/img/chai-logo.png)](http://chaijs.com)
+
+Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that
+can be delightfully paired with any javascript testing framework.
+
+For more information or to download plugins, view the [documentation](http://chaijs.com).
+
+### Contributors
+
+ project : chai
+ repo age : 12 months
+ active : 103 days
+ commits : 553
+ files : 47
+ authors :
+ 408 Jake Luer 73.8%
+ 66 Veselin Todorov 11.9%
+ 39 Domenic Denicola 7.1%
+ 5 Jo Liss 0.9%
+ 5 Scott Nonnenberg 0.9%
+ 5 Juliusz Gonera 0.9%
+ 4 josher19 0.7%
+ 4 John Firebaugh 0.7%
+ 3 Jeff Barczewski 0.5%
+ 2 Jakub Nešetřil 0.4%
+ 2 Teddy Cross 0.4%
+ 1 Chun-Yi 0.2%
+ 1 Niklas Närhinen 0.2%
+ 1 Paul Miller 0.2%
+ 1 Sasha Koss 0.2%
+ 1 Chris Connelly 0.2%
+ 1 Anand Patil 0.2%
+ 1 Benjamin Horsleben 0.2%
+ 1 Victor Costan 0.2%
+ 1 Vinay Pulim 0.2%
+ 1 Kilian Ciuffolo 0.2%
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
3,809 node_modules/chai/chai.js
3,809 additions, 0 deletions not shown
View
1  node_modules/chai/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/chai');
View
79 node_modules/chai/lib/chai.js
@@ -0,0 +1,79 @@
+/*!
+ * chai
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+var used = []
+ , exports = module.exports = {};
+
+/*!
+ * Chai version
+ */
+
+exports.version = '1.4.2';
+
+/*!
+ * Primary `Assertion` prototype
+ */
+
+exports.Assertion = require('./chai/assertion');
+
+/*!
+ * Assertion Error
+ */
+
+exports.AssertionError = require('./chai/error');
+
+/*!
+ * Utils for plugins (not exported)
+ */
+
+var util = require('./chai/utils');
+
+/**
+ * # .use(function)
+ *
+ * Provides a way to extend the internals of Chai
+ *
+ * @param {Function}
+ * @returns {this} for chaining
+ * @api public
+ */
+
+exports.use = function (fn) {
+ if (!~used.indexOf(fn)) {
+ fn(this, util);
+ used.push(fn);
+ }
+
+ return this;
+};
+
+/*!
+ * Core Assertions
+ */
+
+var core = require('./chai/core/assertions');
+exports.use(core);
+
+/*!
+ * Expect interface
+ */
+
+var expect = require('./chai/interface/expect');
+exports.use(expect);
+
+/*!
+ * Should interface
+ */
+
+var should = require('./chai/interface/should');
+exports.use(should);
+
+/*!
+ * Assert interface
+ */
+
+var assert = require('./chai/interface/assert');
+exports.use(assert);
View
117 node_modules/chai/lib/chai/assertion.js
@@ -0,0 +1,117 @@
+/*!
+ * chai
+ * http://chaijs.com
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+/*!
+ * Module dependencies.
+ */
+
+var AssertionError = require('./error')
+ , util = require('./utils')
+ , flag = util.flag;
+
+/*!
+ * Module export.
+ */
+
+module.exports = Assertion;
+
+
+/*!
+ * Assertion Constructor
+ *
+ * Creates object for chaining.
+ *
+ * @api private
+ */
+
+function Assertion (obj, msg, stack) {
+ flag(this, 'ssfi', stack || arguments.callee);
+ flag(this, 'object', obj);
+ flag(this, 'message', msg);
+}
+
+/*!
+ * ### Assertion.includeStack
+ *
+ * User configurable property, influences whether stack trace
+ * is included in Assertion error message. Default of false
+ * suppresses stack trace in the error message
+ *
+ * Assertion.includeStack = true; // enable stack on error
+ *
+ * @api public
+ */
+
+Assertion.includeStack = false;
+
+Assertion.addProperty = function (name, fn) {
+ util.addProperty(this.prototype, name, fn);
+};
+
+Assertion.addMethod = function (name, fn) {
+ util.addMethod(this.prototype, name, fn);
+};
+
+Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
+ util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
+};
+
+Assertion.overwriteProperty = function (name, fn) {
+ util.overwriteProperty(this.prototype, name, fn);
+};
+
+Assertion.overwriteMethod = function (name, fn) {
+ util.overwriteMethod(this.prototype, name, fn);
+};
+
+/*!
+ * ### .assert(expression, message, negateMessage, expected, actual)
+ *
+ * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
+ *
+ * @name assert
+ * @param {Philosophical} expression to be tested
+ * @param {String} message to display if fails
+ * @param {String} negatedMessage to display if negated expression fails
+ * @param {Mixed} expected value (remember to check for negation)
+ * @param {Mixed} actual (optional) will default to `this.obj`
+ * @api private
+ */
+
+Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
+ var ok = util.test(this, arguments);
+ if (true !== showDiff) showDiff = false;
+
+ if (!ok) {
+ var msg = util.getMessage(this, arguments)
+ , actual = util.getActual(this, arguments);
+ throw new AssertionError({
+ message: msg
+ , actual: actual
+ , expected: expected
+ , stackStartFunction: (Assertion.includeStack) ? this.assert : flag(this, 'ssfi')
+ , showDiff: showDiff
+ });
+ }
+};
+
+/*!
+ * ### ._obj
+ *
+ * Quick reference to stored `actual` value for plugin developers.
+ *
+ * @api private
+ */
+
+Object.defineProperty(Assertion.prototype, '_obj',
+ { get: function () {
+ return flag(this, 'object');
+ }
+ , set: function (val) {
+ flag(this, 'object', val);
+ }
+});
View
1,195 node_modules/chai/lib/chai/core/assertions.js
@@ -0,0 +1,1195 @@
+/*!
+ * chai
+ * http://chaijs.com
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+module.exports = function (chai, _) {
+ var Assertion = chai.Assertion
+ , toString = Object.prototype.toString
+ , flag = _.flag;
+
+ /**
+ * ### Language Chains
+ *
+ * The following are provide as chainable getters to
+ * improve the readability of your assertions. They
+ * do not provide an testing capability unless they
+ * have been overwritten by a plugin.
+ *
+ * **Chains**
+ *
+ * - to
+ * - be
+ * - been
+ * - is
+ * - that
+ * - and
+ * - have
+ * - with
+ * - at
+ * - of
+ *
+ * @name language chains
+ * @api public
+ */
+
+ [ 'to', 'be', 'been'
+ , 'is', 'and', 'have'
+ , 'with', 'that', 'at'
+ , 'of' ].forEach(function (chain) {
+ Assertion.addProperty(chain, function () {
+ return this;
+ });
+ });
+
+ /**
+ * ### .not
+ *
+ * Negates any of assertions following in the chain.
+ *
+ * expect(foo).to.not.equal('bar');
+ * expect(goodFn).to.not.throw(Error);
+ * expect({ foo: 'baz' }).to.have.property('foo')
+ * .and.not.equal('bar');
+ *
+ * @name not
+ * @api public
+ */
+
+ Assertion.addProperty('not', function () {
+ flag(this, 'negate', true);
+ });
+
+ /**
+ * ### .deep
+ *
+ * Sets the `deep` flag, later used by the `equal` and
+ * `property` assertions.
+ *
+ * expect(foo).to.deep.equal({ bar: 'baz' });
+ * expect({ foo: { bar: { baz: 'quux' } } })
+ * .to.have.deep.property('foo.bar.baz', 'quux');
+ *
+ * @name deep
+ * @api public
+ */
+
+ Assertion.addProperty('deep', function () {
+ flag(this, 'deep', true);
+ });
+
+ /**
+ * ### .a(type)
+ *
+ * The `a` and `an` assertions are aliases that can be
+ * used either as language chains or to assert a value's
+ * type (as revealed by `Object.prototype.toString`).
+ *
+ * // typeof
+ * expect('test').to.be.a('string');
+ * expect({ foo: 'bar' }).to.be.an('object');
+ * expect(null).to.be.a('null');
+ * expect(undefined).to.be.an('undefined');
+ *
+ * // language chain
+ * expect(foo).to.be.an.instanceof(Foo);
+ *
+ * @name a
+ * @alias an
+ * @param {String} type
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function an(type, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object')
+ , klassStart = type.charAt(0).toUpperCase()
+ , klass = klassStart + type.slice(1)
+ , article = ~[ 'A', 'E', 'I', 'O', 'U' ].indexOf(klassStart) ? 'an ' : 'a ';
+
+ this.assert(
+ '[object ' + klass + ']' === toString.call(obj)
+ , 'expected #{this} to be ' + article + type
+ , 'expected #{this} not to be ' + article + type
+ );
+ }
+
+ Assertion.addChainableMethod('an', an);
+ Assertion.addChainableMethod('a', an);
+
+ /**
+ * ### .include(value)
+ *
+ * The `include` and `contain` assertions can be used as either property
+ * based language chains or as methods to assert the inclusion of an object
+ * in an array or a substring in a string. When used as language chains,
+ * they toggle the `contain` flag for the `keys` assertion.
+ *
+ * expect([1,2,3]).to.include(2);
+ * expect('foobar').to.contain('foo');
+ * expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');
+ *
+ * @name include
+ * @alias contain
+ * @param {Object|String|Number} obj
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function includeChainingBehavior () {
+ flag(this, 'contains', true);
+ }
+
+ function include (val, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object')
+ this.assert(
+ ~obj.indexOf(val)
+ , 'expected #{this} to include ' + _.inspect(val)
+ , 'expected #{this} to not include ' + _.inspect(val));
+ }
+
+ Assertion.addChainableMethod('include', include, includeChainingBehavior);
+ Assertion.addChainableMethod('contain', include, includeChainingBehavior);
+
+ /**
+ * ### .ok
+ *
+ * Asserts that the target is truthy.
+ *
+ * expect('everthing').to.be.ok;
+ * expect(1).to.be.ok;
+ * expect(false).to.not.be.ok;
+ * expect(undefined).to.not.be.ok;
+ * expect(null).to.not.be.ok;
+ *
+ * @name ok
+ * @api public
+ */
+
+ Assertion.addProperty('ok', function () {
+ this.assert(
+ flag(this, 'object')
+ , 'expected #{this} to be truthy'
+ , 'expected #{this} to be falsy');
+ });
+
+ /**
+ * ### .true
+ *
+ * Asserts that the target is `true`.
+ *
+ * expect(true).to.be.true;
+ * expect(1).to.not.be.true;
+ *
+ * @name true
+ * @api public
+ */
+
+ Assertion.addProperty('true', function () {
+ this.assert(
+ true === flag(this, 'object')
+ , 'expected #{this} to be true'
+ , 'expected #{this} to be false'
+ , this.negate ? false : true
+ );
+ });
+
+ /**
+ * ### .false
+ *
+ * Asserts that the target is `false`.
+ *
+ * expect(false).to.be.false;
+ * expect(0).to.not.be.false;
+ *
+ * @name false
+ * @api public
+ */
+
+ Assertion.addProperty('false', function () {
+ this.assert(
+ false === flag(this, 'object')
+ , 'expected #{this} to be false'
+ , 'expected #{this} to be true'
+ , this.negate ? true : false
+ );
+ });
+
+ /**
+ * ### .null
+ *
+ * Asserts that the target is `null`.
+ *
+ * expect(null).to.be.null;
+ * expect(undefined).not.to.be.null;
+ *
+ * @name null
+ * @api public
+ */
+
+ Assertion.addProperty('null', function () {
+ this.assert(
+ null === flag(this, 'object')
+ , 'expected #{this} to be null'
+ , 'expected #{this} not to be null'
+ );
+ });
+
+ /**
+ * ### .undefined
+ *
+ * Asserts that the target is `undefined`.
+ *
+ * expect(undefined).to.be.undefined;
+ * expect(null).to.not.be.undefined;
+ *
+ * @name undefined
+ * @api public
+ */
+
+ Assertion.addProperty('undefined', function () {
+ this.assert(
+ undefined === flag(this, 'object')
+ , 'expected #{this} to be undefined'
+ , 'expected #{this} not to be undefined'
+ );
+ });
+
+ /**
+ * ### .exist
+ *
+ * Asserts that the target is neither `null` nor `undefined`.
+ *
+ * var foo = 'hi'
+ * , bar = null
+ * , baz;
+ *
+ * expect(foo).to.exist;
+ * expect(bar).to.not.exist;
+ * expect(baz).to.not.exist;
+ *
+ * @name exist
+ * @api public
+ */
+
+ Assertion.addProperty('exist', function () {
+ this.assert(
+ null != flag(this, 'object')
+ , 'expected #{this} to exist'
+ , 'expected #{this} to not exist'
+ );
+ });
+
+
+ /**
+ * ### .empty
+ *
+ * Asserts that the target's length is `0`. For arrays, it checks
+ * the `length` property. For objects, it gets the count of
+ * enumerable keys.
+ *
+ * expect([]).to.be.empty;
+ * expect('').to.be.empty;
+ * expect({}).to.be.empty;
+ *
+ * @name empty
+ * @api public
+ */
+
+ Assertion.addProperty('empty', function () {
+ var obj = flag(this, 'object')
+ , expected = obj;
+
+ if (Array.isArray(obj) || 'string' === typeof object) {
+ expected = obj.length;
+ } else if (typeof obj === 'object') {
+ expected = Object.keys(obj).length;
+ }
+
+ this.assert(
+ !expected
+ , 'expected #{this} to be empty'
+ , 'expected #{this} not to be empty'
+ );
+ });
+
+ /**
+ * ### .arguments
+ *
+ * Asserts that the target is an arguments object.
+ *
+ * function test () {
+ * expect(arguments).to.be.arguments;
+ * }
+ *
+ * @name arguments
+ * @alias Arguments
+ * @api public
+ */
+
+ function checkArguments () {
+ var obj = flag(this, 'object')
+ , type = Object.prototype.toString.call(obj);
+ this.assert(
+ '[object Arguments]' === type
+ , 'expected #{this} to be arguments but got ' + type
+ , 'expected #{this} to not be arguments'
+ );
+ }
+
+ Assertion.addProperty('arguments', checkArguments);
+ Assertion.addProperty('Arguments', checkArguments);
+
+ /**
+ * ### .equal(value)
+ *
+ * Asserts that the target is strictly equal (`===`) to `value`.
+ * Alternately, if the `deep` flag is set, asserts that
+ * the target is deeply equal to `value`.
+ *
+ * expect('hello').to.equal('hello');
+ * expect(42).to.equal(42);
+ * expect(1).to.not.equal(true);
+ * expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
+ * expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
+ *
+ * @name equal
+ * @alias equals
+ * @alias eq
+ * @alias deep.equal
+ * @param {Mixed} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertEqual (val, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ if (flag(this, 'deep')) {
+ return this.eql(val);
+ } else {
+ this.assert(
+ val === obj
+ , 'expected #{this} to equal #{exp}'
+ , 'expected #{this} to not equal #{exp}'
+ , val
+ , this._obj
+ , true
+ );
+ }
+ }
+
+ Assertion.addMethod('equal', assertEqual);
+ Assertion.addMethod('equals', assertEqual);
+ Assertion.addMethod('eq', assertEqual);
+
+ /**
+ * ### .eql(value)
+ *
+ * Asserts that the target is deeply equal to `value`.
+ *
+ * expect({ foo: 'bar' }).to.eql({ foo: 'bar' });
+ * expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]);
+ *
+ * @name eql
+ * @param {Mixed} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ Assertion.addMethod('eql', function (obj, msg) {
+ if (msg) flag(this, 'message', msg);
+ this.assert(
+ _.eql(obj, flag(this, 'object'))
+ , 'expected #{this} to deeply equal #{exp}'
+ , 'expected #{this} to not deeply equal #{exp}'
+ , obj
+ , this._obj
+ , true
+ );
+ });
+
+ /**
+ * ### .above(value)
+ *
+ * Asserts that the target is greater than `value`.
+ *
+ * expect(10).to.be.above(5);
+ *
+ * Can also be used in conjunction with `length` to
+ * assert a minimum length. The benefit being a
+ * more informative error message than if the length
+ * was supplied directly.
+ *
+ * expect('foo').to.have.length.above(2);
+ * expect([ 1, 2, 3 ]).to.have.length.above(2);
+ *
+ * @name above
+ * @alias gt
+ * @alias greaterThan
+ * @param {Number} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertAbove (n, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj, msg).to.have.property('length');
+ var len = obj.length;
+ this.assert(
+ len > n
+ , 'expected #{this} to have a length above #{exp} but got #{act}'
+ , 'expected #{this} to not have a length above #{exp}'
+ , n
+ , len
+ );
+ } else {
+ this.assert(
+ obj > n
+ , 'expected #{this} to be above ' + n
+ , 'expected #{this} to be at most ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('above', assertAbove);
+ Assertion.addMethod('gt', assertAbove);
+ Assertion.addMethod('greaterThan', assertAbove);
+
+ /**
+ * ### .least(value)
+ *
+ * Asserts that the target is greater than or equal to `value`.
+ *
+ * expect(10).to.be.at.least(10);
+ *
+ * Can also be used in conjunction with `length` to
+ * assert a minimum length. The benefit being a
+ * more informative error message than if the length
+ * was supplied directly.
+ *
+ * expect('foo').to.have.length.of.at.least(2);
+ * expect([ 1, 2, 3 ]).to.have.length.of.at.least(3);
+ *
+ * @name least
+ * @alias gte
+ * @param {Number} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertLeast (n, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj, msg).to.have.property('length');
+ var len = obj.length;
+ this.assert(
+ len >= n
+ , 'expected #{this} to have a length at least #{exp} but got #{act}'
+ , 'expected #{this} to not have a length below #{exp}'
+ , n
+ , len
+ );
+ } else {
+ this.assert(
+ obj >= n
+ , 'expected #{this} to be at least ' + n
+ , 'expected #{this} to be below ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('least', assertLeast);
+ Assertion.addMethod('gte', assertLeast);
+
+ /**
+ * ### .below(value)
+ *
+ * Asserts that the target is less than `value`.
+ *
+ * expect(5).to.be.below(10);
+ *
+ * Can also be used in conjunction with `length` to
+ * assert a maximum length. The benefit being a
+ * more informative error message than if the length
+ * was supplied directly.
+ *
+ * expect('foo').to.have.length.below(4);
+ * expect([ 1, 2, 3 ]).to.have.length.below(4);
+ *
+ * @name below
+ * @alias lt
+ * @alias lessThan
+ * @param {Number} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertBelow (n, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj, msg).to.have.property('length');
+ var len = obj.length;
+ this.assert(
+ len < n
+ , 'expected #{this} to have a length below #{exp} but got #{act}'
+ , 'expected #{this} to not have a length below #{exp}'
+ , n
+ , len
+ );
+ } else {
+ this.assert(
+ obj < n
+ , 'expected #{this} to be below ' + n
+ , 'expected #{this} to be at least ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('below', assertBelow);
+ Assertion.addMethod('lt', assertBelow);
+ Assertion.addMethod('lessThan', assertBelow);
+
+ /**
+ * ### .most(value)
+ *
+ * Asserts that the target is less than or equal to `value`.
+ *
+ * expect(5).to.be.at.most(5);
+ *
+ * Can also be used in conjunction with `length` to
+ * assert a maximum length. The benefit being a
+ * more informative error message than if the length
+ * was supplied directly.
+ *
+ * expect('foo').to.have.length.of.at.most(4);
+ * expect([ 1, 2, 3 ]).to.have.length.of.at.most(3);
+ *
+ * @name most
+ * @alias lte
+ * @param {Number} value
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertMost (n, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj, msg).to.have.property('length');
+ var len = obj.length;
+ this.assert(
+ len <= n
+ , 'expected #{this} to have a length at most #{exp} but got #{act}'
+ , 'expected #{this} to not have a length above #{exp}'
+ , n
+ , len
+ );
+ } else {
+ this.assert(
+ obj <= n
+ , 'expected #{this} to be at most ' + n
+ , 'expected #{this} to be above ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('most', assertMost);
+ Assertion.addMethod('lte', assertMost);
+
+ /**
+ * ### .within(start, finish)
+ *
+ * Asserts that the target is within a range.
+ *
+ * expect(7).to.be.within(5,10);
+ *
+ * Can also be used in conjunction with `length` to
+ * assert a length range. The benefit being a
+ * more informative error message than if the length
+ * was supplied directly.
+ *
+ * expect('foo').to.have.length.within(2,4);
+ * expect([ 1, 2, 3 ]).to.have.length.within(2,4);
+ *
+ * @name within
+ * @param {Number} start lowerbound inclusive
+ * @param {Number} finish upperbound inclusive
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ Assertion.addMethod('within', function (start, finish, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object')
+ , range = start + '..' + finish;
+ if (flag(this, 'doLength')) {
+ new Assertion(obj, msg).to.have.property('length');
+ var len = obj.length;
+ this.assert(
+ len >= start && len <= finish
+ , 'expected #{this} to have a length within ' + range
+ , 'expected #{this} to not have a length within ' + range
+ );
+ } else {
+ this.assert(
+ obj >= start && obj <= finish
+ , 'expected #{this} to be within ' + range
+ , 'expected #{this} to not be within ' + range
+ );
+ }
+ });
+
+ /**
+ * ### .instanceof(constructor)
+ *
+ * Asserts that the target is an instance of `constructor`.
+ *
+ * var Tea = function (name) { this.name = name; }
+ * , Chai = new Tea('chai');
+ *
+ * expect(Chai).to.be.an.instanceof(Tea);
+ * expect([ 1, 2, 3 ]).to.be.instanceof(Array);
+ *
+ * @name instanceof
+ * @param {Constructor} constructor
+ * @param {String} message _optional_
+ * @alias instanceOf
+ * @api public
+ */
+
+ function assertInstanceOf (constructor, msg) {
+ if (msg) flag(this, 'message', msg);
+ var name = _.getName(constructor);
+ this.assert(
+ flag(this, 'object') instanceof constructor
+ , 'expected #{this} to be an instance of ' + name
+ , 'expected #{this} to not be an instance of ' + name
+ );
+ };
+
+ Assertion.addMethod('instanceof', assertInstanceOf);
+ Assertion.addMethod('instanceOf', assertInstanceOf);
+
+ /**
+ * ### .property(name, [value])
+ *
+ * Asserts that the target has a property `name`, optionally asserting that
+ * the value of that property is strictly equal to `value`.
+ * If the `deep` flag is set, you can use dot- and bracket-notation for deep
+ * references into objects and arrays.
+ *
+ * // simple referencing
+ * var obj = { foo: 'bar' };
+ * expect(obj).to.have.property('foo');
+ * expect(obj).to.have.property('foo', 'bar');
+ *
+ * // deep referencing
+ * var deepObj = {
+ * green: { tea: 'matcha' }
+ * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ]
+ * };
+
+ * expect(deepObj).to.have.deep.property('green.tea', 'matcha');
+ * expect(deepObj).to.have.deep.property('teas[1]', 'matcha');
+ * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha');
+ *
+ * You can also use an array as the starting point of a `deep.property`
+ * assertion, or traverse nested arrays.
+ *
+ * var arr = [
+ * [ 'chai', 'matcha', 'konacha' ]
+ * , [ { tea: 'chai' }
+ * , { tea: 'matcha' }
+ * , { tea: 'konacha' } ]
+ * ];
+ *
+ * expect(arr).to.have.deep.property('[0][1]', 'matcha');
+ * expect(arr).to.have.deep.property('[1][2].tea', 'konacha');
+ *
+ * Furthermore, `property` changes the subject of the assertion
+ * to be the value of that property from the original object. This
+ * permits for further chainable assertions on that property.
+ *
+ * expect(obj).to.have.property('foo')
+ * .that.is.a('string');
+ * expect(deepObj).to.have.property('green')
+ * .that.is.an('object')
+ * .that.deep.equals({ tea: 'matcha' });
+ * expect(deepObj).to.have.property('teas')
+ * .that.is.an('array')
+ * .with.deep.property('[2]')
+ * .that.deep.equals({ tea: 'konacha' });
+ *
+ * @name property
+ * @alias deep.property
+ * @param {String} name
+ * @param {Mixed} value (optional)
+ * @param {String} message _optional_
+ * @returns value of property for chaining
+ * @api public
+ */
+
+ Assertion.addMethod('property', function (name, val, msg) {
+ if (msg) flag(this, 'message', msg);
+
+ var descriptor = flag(this, 'deep') ? 'deep property ' : 'property '
+ , negate = flag(this, 'negate')
+ , obj = flag(this, 'object')
+ , value = flag(this, 'deep')
+ ? _.getPathValue(name, obj)
+ : obj[name];
+
+ if (negate && undefined !== val) {
+ if (undefined === value) {
+ msg = (msg != null) ? msg + ': ' : '';
+ throw new Error(msg + _.inspect(obj) + ' has no ' + descriptor + _.inspect(name));
+ }
+ } else {
+ this.assert(
+ undefined !== value
+ , 'expected #{this} to have a ' + descriptor + _.inspect(name)
+ , 'expected #{this} to not have ' + descriptor + _.inspect(name));
+ }
+
+ if (undefined !== val) {
+ this.assert(
+ val === value
+ , 'expected #{this} to have a ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'
+ , 'expected #{this} to not have a ' + descriptor + _.inspect(name) + ' of #{act}'
+ , val
+ , value
+ );
+ }
+
+ flag(this, 'object', value);
+ });
+
+
+ /**
+ * ### .ownProperty(name)
+ *
+ * Asserts that the target has an own property `name`.
+ *
+ * expect('test').to.have.ownProperty('length');
+ *
+ * @name ownProperty
+ * @alias haveOwnProperty
+ * @param {String} name
+ * @param {String} message _optional_
+ * @api public
+ */
+
+ function assertOwnProperty (name, msg) {
+ if (msg) flag(this, 'message', msg);
+ var obj = flag(this, 'object');
+ this.assert(
+ obj.hasOwnProperty(name)
+ , 'expected #{this} to have own property ' + _.inspect(name)
+ , 'expected #{this} to not have own property ' + _.inspect(name)
+ );
+ }
+
+ Assertion.addMethod('ownProperty', assertOwnProperty);
+ Assertion.addMethod('haveOwnProperty', assertOwnProperty);
+
+ /**
+ * ### .length(value)
+ *
+ * Asserts that the target's `length` property has
+ * the expected value.
+ *
+ * expect([ 1, 2, 3]).to.have.length(3);
+ * expect('foobar').to.have.length(6);
+ *
+ * Can also be used as a chain precursor to a value
+ * comparison for the length property.
+ *
+ * expect('foo').to.have.length.above(2);
+ * expect([ 1, 2, 3 ]).to.have.length.above(2);
+ * expect('foo').to.have.length.below(4);
+ * expect([ 1, 2, 3 ]).to.have.length.below(4);
+ * expe