Browse files

removed lib, added chai

  • Loading branch information...
1 parent f1ade1c commit 3ea38144acc63f0cc848f06ca65e46746ee45de7 @TJkrusinski TJkrusinski committed Sep 28, 2012
Showing with 7,832 additions and 1 deletion.
  1. 0 {lib → }/foursquare.js
  2. +0 −1 lib/index.js
  3. +9 −0 node_modules/chai/.npmignore
  4. +627 −0 node_modules/chai/History.md
  5. +52 −0 node_modules/chai/README.md
  6. +3,590 −0 node_modules/chai/chai.js
  7. +3 −0 node_modules/chai/index.js
  8. +79 −0 node_modules/chai/lib/chai.js
  9. +115 −0 node_modules/chai/lib/chai/assertion.js
  10. +28 −0 node_modules/chai/lib/chai/browser/error.js
  11. +1,051 −0 node_modules/chai/lib/chai/core/assertions.js
  12. +59 −0 node_modules/chai/lib/chai/error.js
  13. +982 −0 node_modules/chai/lib/chai/interface/assert.js
  14. +12 −0 node_modules/chai/lib/chai/interface/expect.js
  15. +62 −0 node_modules/chai/lib/chai/interface/should.js
  16. +70 −0 node_modules/chai/lib/chai/utils/addChainableMethod.js
  17. +37 −0 node_modules/chai/lib/chai/utils/addMethod.js
  18. +40 −0 node_modules/chai/lib/chai/utils/addProperty.js
  19. +100 −0 node_modules/chai/lib/chai/utils/eql.js
  20. +32 −0 node_modules/chai/lib/chai/utils/flag.js
  21. +19 −0 node_modules/chai/lib/chai/utils/getActual.js
  22. +49 −0 node_modules/chai/lib/chai/utils/getMessage.js
  23. +20 −0 node_modules/chai/lib/chai/utils/getName.js
  24. +102 −0 node_modules/chai/lib/chai/utils/getPathValue.js
  25. +102 −0 node_modules/chai/lib/chai/utils/index.js
  26. +314 −0 node_modules/chai/lib/chai/utils/inspect.js
  27. +44 −0 node_modules/chai/lib/chai/utils/objDisplay.js
  28. +51 −0 node_modules/chai/lib/chai/utils/overwriteMethod.js
  29. +54 −0 node_modules/chai/lib/chai/utils/overwriteProperty.js
  30. +26 −0 node_modules/chai/lib/chai/utils/test.js
  31. +44 −0 node_modules/chai/lib/chai/utils/transferFlags.js
  32. +59 −0 node_modules/chai/package.json
View
0 lib/foursquare.js → foursquare.js
File renamed without changes.
View
1 lib/index.js
@@ -1 +0,0 @@
-module.exports = require('./foursquare.js');
View
9 node_modules/chai/.npmignore
@@ -0,0 +1,9 @@
+.git*
+support/
+test/
+.DS_Store
+coverage.html
+lib-cov
+.travis.yml
+Makefile
+.mailmap
View
627 node_modules/chai/History.md
@@ -0,0 +1,627 @@
+
+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
52 node_modules/chai/README.md
@@ -0,0 +1,52 @@
+[![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
+
+ commits: 493
+ files : 45
+ authors:
+ 363 Jake Luer 73.6%
+ 66 Veselin Todorov 13.4%
+ 36 Domenic Denicola 7.3%
+ 5 Jo Liss 1.0%
+ 5 Juliusz Gonera 1.0%
+ 4 josher19 0.8%
+ 4 John Firebaugh 0.8%
+ 3 Jeff Barczewski 0.6%
+ 2 Jakub Nešetřil 0.4%
+ 1 Anand Patil 0.2%
+ 1 Benjamin Horsleben 0.2%
+ 1 Vinay Pulim 0.2%
+ 1 Sasha Koss 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,590 node_modules/chai/chai.js
3,590 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
3 node_modules/chai/index.js
@@ -0,0 +1,3 @@
+module.exports = (process && process.env && process.env.CHAI_COV)
+ ? require('./lib-cov/chai')
+ : 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.2.0';
+
+/*!
+ * 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
115 node_modules/chai/lib/chai/assertion.js
@@ -0,0 +1,115 @@
+/*!
+ * 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) {
+ var ok = util.test(this, arguments);
+
+ 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')
+ });
+ }
+};
+
+/*!
+ * ### ._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
28 node_modules/chai/lib/chai/browser/error.js
@@ -0,0 +1,28 @@
+/*!
+ * chai
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+module.exports = AssertionError;
+
+function AssertionError (options) {
+ options = options || {};
+ this.message = options.message;
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+
+ if (options.stackStartFunction && Error.captureStackTrace) {
+ var stackStartFunction = options.stackStartFunction;
+ Error.captureStackTrace(this, stackStartFunction);
+ }
+}
+
+AssertionError.prototype = Object.create(Error.prototype);
+AssertionError.prototype.name = 'AssertionError';
+AssertionError.prototype.constructor = AssertionError;
+
+AssertionError.prototype.toString = function() {
+ return this.message;
+};
View
1,051 node_modules/chai/lib/chai/core/assertions.js
@@ -0,0 +1,1051 @@
+/*!
+ * 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
+ *
+ * @name language chains
+ * @api public
+ */
+
+ [ 'to', 'be', 'been'
+ , 'is', 'and', 'have'
+ , 'with', 'that' ].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
+ * @api public
+ */
+
+ function an(type) {
+ 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
+ * @api public
+ */
+
+ function includeChainingBehavior () {
+ flag(this, 'contains', true);
+ }
+
+ function include (val) {
+ 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
+ * @api public
+ */
+
+ function assertEqual (val) {
+ 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
+ );
+ }
+ }
+
+ 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
+ * @api public
+ */
+
+ Assertion.addMethod('eql', function (obj) {
+ this.assert(
+ _.eql(obj, flag(this, 'object'))
+ , 'expected #{this} to deeply equal #{exp}'
+ , 'expected #{this} to not deeply equal #{exp}'
+ , obj
+ );
+ });
+
+ /**
+ * ### .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
+ * @api public
+ */
+
+ function assertAbove (n) {
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj).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 below ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('above', assertAbove);
+ Assertion.addMethod('gt', assertAbove);
+ Assertion.addMethod('greaterThan', assertAbove);
+
+ /**
+ * ### .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
+ * @api public
+ */
+
+ function assertBelow (n) {
+ var obj = flag(this, 'object');
+ if (flag(this, 'doLength')) {
+ new Assertion(obj).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 above ' + n
+ );
+ }
+ }
+
+ Assertion.addMethod('below', assertBelow);
+ Assertion.addMethod('lt', assertBelow);
+ Assertion.addMethod('lessThan', assertBelow);
+
+ /**
+ * ### .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
+ * @api public
+ */
+
+ Assertion.addMethod('within', function (start, finish) {
+ var obj = flag(this, 'object')
+ , range = start + '..' + finish;
+ if (flag(this, 'doLength')) {
+ new Assertion(obj).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
+ * @alias instanceOf
+ * @api public
+ */
+
+ function assertInstanceOf (constructor) {
+ 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)
+ * @returns value of property for chaining
+ * @api public
+ */
+
+ Assertion.addMethod('property', function (name, val) {
+ 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) {
+ throw new Error(_.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
+ * @api public
+ */
+
+ function assertOwnProperty (name) {
+ 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);
+ * expect('foo').to.have.length.within(2,4);
+ * expect([ 1, 2, 3 ]).to.have.length.within(2,4);
+ *
+ * @name length
+ * @alias lengthOf
+ * @param {Number} length
+ * @api public
+ */
+
+ function assertLengthChain () {
+ flag(this, 'doLength', true);
+ }
+
+ function assertLength (n) {
+ var obj = flag(this, 'object');
+ new Assertion(obj).to.have.property('length');
+ var len = obj.length;
+
+ this.assert(
+ len == n
+ , 'expected #{this} to have a length of #{exp} but got #{act}'
+ , 'expected #{this} to not have a length of #{act}'
+ , n
+ , len
+ );
+ }
+
+ Assertion.addChainableMethod('length', assertLength, assertLengthChain);
+ Assertion.addMethod('lengthOf', assertLength, assertLengthChain);
+
+ /**
+ * ### .match(regexp)
+ *
+ * Asserts that the target matches a regular expression.
+ *
+ * expect('foobar').to.match(/^foo/);
+ *
+ * @name match
+ * @param {RegExp} RegularExpression
+ * @api public
+ */
+
+ Assertion.addMethod('match', function (re) {
+ var obj = flag(this, 'object');
+ this.assert(
+ re.exec(obj)
+ , 'expected #{this} to match ' + re
+ , 'expected #{this} not to match ' + re
+ );
+ });
+
+ /**
+ * ### .string(string)
+ *
+ * Asserts that the string target contains another string.
+ *
+ * expect('foobar').to.have.string('bar');
+ *
+ * @name string
+ * @param {String} string
+ * @api public
+ */
+
+ Assertion.addMethod('string', function (str) {
+ var obj = flag(this, 'object');
+ new Assertion(obj).is.a('string');
+
+ this.assert(
+ ~obj.indexOf(str)
+ , 'expected #{this} to contain ' + _.inspect(str)
+ , 'expected #{this} to not contain ' + _.inspect(str)
+ );
+ });
+
+
+ /**
+ * ### .keys(key1, [key2], [...])
+ *
+ * Asserts that the target has exactly the given keys, or
+ * asserts the inclusion of some keys when using the
+ * `include` or `contain` modifiers.
+ *
+ * expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']);
+ * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar');
+ *
+ * @name keys
+ * @alias key
+ * @param {String...|Array} keys
+ * @api public
+ */
+
+ function assertKeys (keys) {
+ var obj = flag(this, 'object')
+ , str
+ , ok = true;
+
+ keys = keys instanceof Array
+ ? keys
+ : Array.prototype.slice.call(arguments);
+
+ if (!keys.length) throw new Error('keys required');
+
+ var actual = Object.keys(obj)
+ , len = keys.length;
+
+ // Inclusion
+ ok = keys.every(function(key){
+ return ~actual.indexOf(key);
+ });
+
+ // Strict
+ if (!flag(this, 'negate') && !flag(this, 'contains')) {
+ ok = ok && keys.length == actual.length;
+ }
+
+ // Key string
+ if (len > 1) {
+ keys = keys.map(function(key){
+ return _.inspect(key);
+ });
+ var last = keys.pop();
+ str = keys.join(', ') + ', and ' + last;
+ } else {
+ str = _.inspect(keys[0]);
+ }
+
+ // Form
+ str = (len > 1 ? 'keys ' : 'key ') + str;
+
+ // Have / include
+ str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;
+
+ // Assertion
+ this.assert(
+ ok
+ , 'expected #{this} to ' + str
+ , 'expected #{this} to not ' + str
+ );
+ }
+
+ Assertion.addMethod('keys', assertKeys);
+ Assertion.addMethod('key', assertKeys);
+
+ /**
+ * ### .throw(constructor)
+ *
+ * Asserts that the function target will throw a specific error, or specific type of error
+ * (as determined using `instanceof`), optionally with a RegExp or string inclusion test
+ * for the error's message.
+ *
+ * var err = new ReferenceError('This is a bad function.');
+ * var fn = function () { throw err; }
+ * expect(fn).to.throw(ReferenceError);
+ * expect(fn).to.throw(Error);
+ * expect(fn).to.throw(/bad function/);
+ * expect(fn).to.not.throw('good function');
+ * expect(fn).to.throw(ReferenceError, /bad function/);
+ * expect(fn).to.throw(err);
+ * expect(fn).to.not.throw(new RangeError('Out of range.'));
+ *
+ * Please note that when a throw expectation is negated, it will check each
+ * parameter independently, starting with error constructor type. The appropriate way
+ * to check for the existence of a type of error but for a message that does not match
+ * is to use `and`.
+ *
+ * expect(fn).to.throw(ReferenceError)
+ * .and.not.throw(/good function/);
+ *
+ * @name throw
+ * @alias throws
+ * @alias Throw
+ * @param {ErrorConstructor} constructor
+ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
+ * @api public
+ */
+
+ function assertThrows (constructor, msg) {
+ var obj = flag(this, 'object');
+ new Assertion(obj).is.a('function');
+
+ var thrown = false
+ , desiredError = null
+ , name = null;
+
+ if (arguments.length === 0) {
+ msg = null;
+ constructor = null;
+ } else if (constructor && (constructor instanceof RegExp || 'string' === typeof constructor)) {
+ msg = constructor;
+ constructor = null;
+ } else if (constructor && constructor instanceof Error) {
+ desiredError = constructor;
+ constructor = null;
+ msg = null;
+ } else if (typeof constructor === 'function') {
+ name = (new constructor()).name;
+ } else {
+ constructor = null;
+ }
+
+ try {
+ obj();
+ } catch (err) {
+ // first, check desired error
+ if (desiredError) {
+ this.assert(
+ err === desiredError
+ , 'expected #{this} to throw ' + _.inspect(desiredError) + ' but ' + _.inspect(err) + ' was thrown'
+ , 'expected #{this} to not throw ' + _.inspect(desiredError)
+ );
+ return this;
+ }
+ // next, check constructor
+ if (constructor) {
+ this.assert(
+ err instanceof constructor
+ , 'expected #{this} to throw ' + name + ' but a ' + err.name + ' was thrown'
+ , 'expected #{this} to not throw ' + name );
+ if (!msg) return this;
+ }
+ // next, check message
+ if (err.message && msg && msg instanceof RegExp) {
+ this.assert(
+ msg.exec(err.message)
+ , 'expected #{this} to throw error matching ' + msg + ' but got ' + _.inspect(err.message)
+ , 'expected #{this} to throw error not matching ' + msg
+ );
+ return this;
+ } else if (err.message && msg && 'string' === typeof msg) {
+ this.assert(
+ ~err.message.indexOf(msg)
+ , 'expected #{this} to throw error including #{exp} but got #{act}'
+ , 'expected #{this} to throw error not including #{act}'
+ , msg
+ , err.message
+ );
+ return this;
+ } else {
+ thrown = true;
+ }
+ }
+
+ var expectedThrown = name ? name : desiredError ? _.inspect(desiredError) : 'an error';
+
+ this.assert(
+ thrown === true
+ , 'expected #{this} to throw ' + expectedThrown
+ , 'expected #{this} to not throw ' + expectedThrown
+ );
+ };
+
+ Assertion.addMethod('throw', assertThrows);
+ Assertion.addMethod('throws', assertThrows);
+ Assertion.addMethod('Throw', assertThrows);
+
+ /**
+ * ### .respondTo(method)
+ *
+ * Asserts that the object or class target will respond to a method.
+ *
+ * Klass.prototype.bar = function(){};
+ * expect(Klass).to.respondTo('bar');
+ * expect(obj).to.respondTo('bar');
+ *
+ * To check if a constructor will respond to a static function,
+ * set the `itself` flag.
+ *
+ * Klass.baz = function(){};
+ * expect(Klass).itself.to.respondTo('baz');
+ *
+ * @name respondTo
+ * @param {String} method
+ * @api public
+ */
+
+ Assertion.addMethod('respondTo', function (method) {
+ var obj = flag(this, 'object')
+ , itself = flag(this, 'itself')
+ , context = ('function' === typeof obj && !itself)
+ ? obj.prototype[method]
+ : obj[method];
+
+ this.assert(
+ 'function' === typeof context
+ , 'expected #{this} to respond to ' + _.inspect(method)
+ , 'expected #{this} to not respond to ' + _.inspect(method)
+ );
+ });
+
+ /**
+ * ### .itself
+ *
+ * Sets the `itself` flag, later used by the `respondTo` assertion.
+ *
+ * function Foo() {}
+ * Foo.bar = function() {}
+ * Foo.prototype.baz = function() {}
+ *
+ * expect(Foo).itself.to.respondTo('bar');
+ * expect(Foo).itself.not.to.respondTo('baz');
+ *
+ * @name itself
+ * @api public
+ */
+
+ Assertion.addProperty('itself', function () {
+ flag(this, 'itself', true);
+ });
+
+ /**
+ * ### .satisfy(method)
+ *
+ * Asserts that the target passes a given truth test.
+ *
+ * expect(1).to.satisfy(function(num) { return num > 0; });
+ *
+ * @name satisfy
+ * @param {Function} matcher
+ * @api public
+ */
+
+ Assertion.addMethod('satisfy', function (matcher) {
+ var obj = flag(this, 'object');
+ this.assert(
+ matcher(obj)
+ , 'expected #{this} to satisfy ' + _.inspect(matcher)
+ , 'expected #{this} to not satisfy' + _.inspect(matcher)
+ , this.negate ? false : true
+ , matcher(obj)
+ );
+ });
+
+ /**
+ * ### .closeTo(expected, delta)
+ *
+ * Asserts that the target is equal `expected`, to within a +/- `delta` range.
+ *
+ * expect(1.5).to.be.closeTo(1, 0.5);
+ *
+ * @name closeTo
+ * @param {Number} expected
+ * @param {Number} delta
+ * @api public
+ */
+
+ Assertion.addMethod('closeTo', function (expected, delta) {
+ var obj = flag(this, 'object');
+ this.assert(
+ Math.abs(obj - expected) <= delta
+ , 'expected #{this} to be close to ' + expected + ' +/- ' + delta
+ , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta
+ );
+ });
+
+};
View
59 node_modules/chai/lib/chai/error.js
@@ -0,0 +1,59 @@
+/*!
+ * chai
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+/*!
+ * Main export
+ */
+
+module.exports = AssertionError;
+
+/**
+ * # AssertionError (constructor)
+ *
+ * Create a new assertion error based on the Javascript
+ * `Error` prototype.
+ *
+ * **Options**
+ * - message
+ * - actual
+ * - expected
+ * - operator
+ * - startStackFunction
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+function AssertionError (options) {
+ options = options || {};
+ this.message = options.message;
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+
+ if (options.stackStartFunction && Error.captureStackTrace) {
+ var stackStartFunction = options.stackStartFunction;
+ Error.captureStackTrace(this, stackStartFunction);
+ }
+}
+
+/*!
+ * Inherit from Error
+ */
+
+AssertionError.prototype = Object.create(Error.prototype);
+AssertionError.prototype.name = 'AssertionError';
+AssertionError.prototype.constructor = AssertionError;
+
+/**
+ * # toString()
+ *
+ * Override default to string method
+ */
+
+AssertionError.prototype.toString = function() {
+ return this.message;
+};
View
982 node_modules/chai/lib/chai/interface/assert.js
@@ -0,0 +1,982 @@
+/*!
+ * chai
+ * Copyright(c) 2011-2012 Jake Luer <jake@alogicalparadox.com>
+ * MIT Licensed
+ */
+
+
+module.exports = function (chai, util) {
+
+ /*!
+ * Chai dependencies.
+ */
+
+ var Assertion = chai.Assertion
+ , flag = util.flag;
+
+ /*!
+ * Module export.
+ */
+
+ /**
+ * ### assert(expression, message)
+ *
+ * Write your own test expressions.
+ *
+ * assert('foo' !== 'bar', 'foo is not bar');
+ * assert(Array.isArray([]), 'empty arrays are arrays');
+ *
+ * @param {Mixed} expression to test for truthiness
+ * @param {String} message to display on error
+ * @name assert
+ * @api public
+ */
+
+ var assert = chai.assert = function (express, errmsg) {
+ var test = new Assertion(null);
+ test.assert(
+ express
+ , errmsg
+ , '[ negation message unavailable ]'
+ );
+ };
+
+ /**
+ * ### .fail(actual, expected, [message], [operator])
+ *
+ * Throw a failure. Node.js `assert` module-compatible.
+ *
+ * @name fail
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @param {String} operator
+ * @api public
+ */
+
+ assert.fail = function (actual, expected, message, operator) {
+ throw new chai.AssertionError({
+ actual: actual
+ , expected: expected
+ , message: message
+ , operator: operator
+ , stackStartFunction: assert.fail
+ });
+ };
+
+ /**
+ * ### .ok(object, [message])
+ *
+ * Asserts that `object` is truthy.
+ *
+ * assert.ok('everything', 'everything is ok');
+ * assert.ok(false, 'this will fail');
+ *
+ * @name ok
+ * @param {Mixed} object to test
+ * @param {String} message
+ * @api public
+ */
+
+ assert.ok = function (val, msg) {
+ new Assertion(val, msg).is.ok;
+ };
+
+ /**
+ * ### .equal(actual, expected, [message])
+ *
+ * Asserts non-strict equality (`==`) of `actual` and `expected`.
+ *
+ * assert.equal(3, '3', '== coerces values to strings');
+ *
+ * @name equal
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.equal = function (act, exp, msg) {
+ var test = new Assertion(act, msg);
+
+ test.assert(
+ exp == flag(test, 'object')
+ , 'expected #{this} to equal #{exp}'
+ , 'expected #{this} to not equal #{act}'
+ , exp
+ , act
+ );
+ };
+
+ /**
+ * ### .notEqual(actual, expected, [message])
+ *
+ * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
+ *
+ * assert.notEqual(3, 4, 'these numbers are not equal');
+ *
+ * @name notEqual
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.notEqual = function (act, exp, msg) {
+ var test = new Assertion(act, msg);
+
+ test.assert(
+ exp != flag(test, 'object')
+ , 'expected #{this} to not equal #{exp}'
+ , 'expected #{this} to equal #{act}'
+ , exp
+ , act
+ );
+ };
+
+ /**
+ * ### .strictEqual(actual, expected, [message])
+ *
+ * Asserts strict equality (`===`) of `actual` and `expected`.
+ *
+ * assert.strictEqual(true, true, 'these booleans are strictly equal');
+ *
+ * @name strictEqual
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.strictEqual = function (act, exp, msg) {
+ new Assertion(act, msg).to.equal(exp);
+ };
+
+ /**
+ * ### .notStrictEqual(actual, expected, [message])
+ *
+ * Asserts strict inequality (`!==`) of `actual` and `expected`.
+ *
+ * assert.notStrictEqual(3, '3', 'no coercion for strict equality');
+ *
+ * @name notStrictEqual
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.notStrictEqual = function (act, exp, msg) {
+ new Assertion(act, msg).to.not.equal(exp);
+ };
+
+ /**
+ * ### .deepEqual(actual, expected, [message])
+ *
+ * Asserts that `actual` is deeply equal to `expected`.
+ *
+ * assert.deepEqual({ tea: 'green' }, { tea: 'green' });
+ *
+ * @name deepEqual
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.deepEqual = function (act, exp, msg) {
+ new Assertion(act, msg).to.eql(exp);
+ };
+
+ /**
+ * ### .notDeepEqual(actual, expected, [message])
+ *
+ * Assert that `actual` is not deeply equal to `expected`.
+ *
+ * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
+ *
+ * @name notDeepEqual
+ * @param {Mixed} actual
+ * @param {Mixed} expected
+ * @param {String} message
+ * @api public
+ */
+
+ assert.notDeepEqual = function (act, exp, msg) {
+ new Assertion(act, msg).to.not.eql(exp);
+ };
+
+ /**
+ * ### .isTrue(value, [message])
+ *
+ * Asserts that `value` is true.
+ *
+ * var teaServed = true;
+ * assert.isTrue(teaServed, 'the tea has been served');
+ *
+ * @name isTrue
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isTrue = function (val, msg) {
+ new Assertion(val, msg).is['true'];
+ };
+
+ /**
+ * ### .isFalse(value, [message])
+ *
+ * Asserts that `value` is false.
+ *
+ * var teaServed = false;
+ * assert.isFalse(teaServed, 'no tea yet? hmm...');
+ *
+ * @name isFalse
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isFalse = function (val, msg) {
+ new Assertion(val, msg).is['false'];
+ };
+
+ /**
+ * ### .isNull(value, [message])
+ *
+ * Asserts that `value` is null.
+ *
+ * assert.isNull(err, 'there was no error');
+ *
+ * @name isNull
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isNull = function (val, msg) {
+ new Assertion(val, msg).to.equal(null);
+ };
+
+ /**
+ * ### .isNotNull(value, [message])
+ *
+ * Asserts that `value` is not null.
+ *
+ * var tea = 'tasty chai';
+ * assert.isNotNull(tea, 'great, time for tea!');
+ *
+ * @name isNotNull
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isNotNull = function (val, msg) {
+ new Assertion(val, msg).to.not.equal(null);
+ };
+
+ /**
+ * ### .isUndefined(value, [message])
+ *
+ * Asserts that `value` is `undefined`.
+ *
+ * var tea;
+ * assert.isUndefined(tea, 'no tea defined');
+ *
+ * @name isUndefined
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isUndefined = function (val, msg) {
+ new Assertion(val, msg).to.equal(undefined);
+ };
+
+ /**
+ * ### .isDefined(value, [message])
+ *
+ * Asserts that `value` is not `undefined`.
+ *
+ * var tea = 'cup of chai';
+ * assert.isDefined(tea, 'tea has been defined');
+ *
+ * @name isUndefined
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isDefined = function (val, msg) {
+ new Assertion(val, msg).to.not.equal(undefined);
+ };
+
+ /**
+ * ### .isFunction(value, [message])
+ *
+ * Asserts that `value` is a function.
+ *
+ * function serveTea() { return 'cup of tea'; };
+ * assert.isFunction(serveTea, 'great, we can have tea now');
+ *
+ * @name isFunction
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isFunction = function (val, msg) {
+ new Assertion(val, msg).to.be.a('function');
+ };
+
+ /**
+ * ### .isNotFunction(value, [message])
+ *
+ * Asserts that `value` is _not_ a function.
+ *
+ * var serveTea = [ 'heat', 'pour', 'sip' ];
+ * assert.isNotFunction(serveTea, 'great, we have listed the steps');
+ *
+ * @name isNotFunction
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isNotFunction = function (val, msg) {
+ new Assertion(val, msg).to.not.be.a('function');
+ };
+
+ /**
+ * ### .isObject(value, [message])
+ *
+ * Asserts that `value` is an object (as revealed by
+ * `Object.prototype.toString`).
+ *
+ * var selection = { name: 'Chai', serve: 'with spices' };
+ * assert.isObject(selection, 'tea selection is an object');
+ *
+ * @name isObject
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isObject = function (val, msg) {
+ new Assertion(val, msg).to.be.a('object');
+ };
+
+ /**
+ * ### .isNotObject(value, [message])
+ *
+ * Asserts that `value` is _not_ an object.
+ *
+ * var selection = 'chai'
+ * assert.isObject(selection, 'tea selection is not an object');
+ * assert.isObject(null, 'null is not an object');
+ *
+ * @name isNotObject
+ * @param {Mixed} value
+ * @param {String} message
+ * @api public
+ */
+
+ assert.isNotObject = function (val, msg) {
+ new Assertion(val, msg).to.