konacha 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +1 -4
- data/Gemfile +3 -0
- data/Gemfile-rails3 +5 -0
- data/History.md +6 -0
- data/README.md +14 -7
- data/app/assets/stylesheets/konacha.css +10 -1
- data/konacha.gemspec +2 -2
- data/lib/konacha/reporter/example.rb +7 -0
- data/lib/konacha/reporter/example_group.rb +8 -0
- data/spec/dummy/config/application.rb +0 -1
- data/spec/reporter/example_group_spec.rb +24 -2
- data/spec/reporter/example_spec.rb +24 -2
- data/spec/runner_spec.rb +1 -1
- data/vendor/assets/javascripts/chai.js +831 -386
- data/vendor/assets/javascripts/mocha.js +786 -347
- data/vendor/assets/stylesheets/mocha.css +31 -11
- metadata +48 -81
- data/Gemfile-rails4 +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9706057c4d4f50ab91f189c6a9c116e0990795c6
|
4
|
+
data.tar.gz: 34ca0d65cb02b227dbb22dcce18ec0e9e91d1927
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28e650c18b0f41f2ccd199c3b8b1eca3c62ecebf06e117d06ca0aa0ee3242d7e8dc9a94d4898504c82129f95f5ba1e822626b7fb373e34ce51c41c8fde1d7e2d
|
7
|
+
data.tar.gz: b0f2fd3fbb0a117345ee85804e970a1bbaf047718c5a73354b616fd098d899829e8e6e58fccb9b66f0ef97105f69a1ab4b8f1e493acd1b12b734acb9ea742499
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile-rails3
ADDED
data/History.md
CHANGED
data/README.md
CHANGED
@@ -182,8 +182,8 @@ Konacha can be configured in an initializer, e.g. `config/initializers/konacha.r
|
|
182
182
|
Konacha.configure do |config|
|
183
183
|
config.spec_dir = "spec/javascripts"
|
184
184
|
config.spec_matcher = /_spec\.|_test\./
|
185
|
-
config.driver = :selenium
|
186
185
|
config.stylesheets = %w(application)
|
186
|
+
config.driver = :selenium
|
187
187
|
end if defined?(Konacha)
|
188
188
|
```
|
189
189
|
|
@@ -192,13 +192,20 @@ environment.
|
|
192
192
|
|
193
193
|
The `spec_dir` option tells Konacha where to find JavaScript specs. `spec_matcher`
|
194
194
|
is an object responding to `===` (most likely a `Regexp`); it receives a filename
|
195
|
-
and should return true if the file is a spec. `
|
196
|
-
|
197
|
-
|
198
|
-
The `stylesheets` option sets the stylesheets to be linked from the `<head>`
|
199
|
-
of the test runner iframe.
|
195
|
+
and should return true if the file is a spec. The `stylesheets` option sets the
|
196
|
+
stylesheets to be linked from the `<head>` of the test runner iframe. `driver`
|
197
|
+
names a Capybara driver used for the `run` task. The values above are the defaults.
|
200
198
|
|
201
|
-
|
199
|
+
For [PhantomJS](https://github.com/jonleighton/poltergeist#installing-phantomjs)
|
200
|
+
support you can use the [poltergeist](https://github.com/jonleighton/poltergeist)
|
201
|
+
driver. Require capybara/poltergeist in the configure block:
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
Konacha.configure do |config|
|
205
|
+
require 'capybara/poltergeist'
|
206
|
+
config.driver = :poltergeist
|
207
|
+
end if defined?(Konacha)
|
208
|
+
```
|
202
209
|
|
203
210
|
## Test Interface and Assertions
|
204
211
|
|
@@ -13,7 +13,7 @@ body {
|
|
13
13
|
-o-transform-origin: right top;
|
14
14
|
transform-origin: right top;
|
15
15
|
|
16
|
-
width:
|
16
|
+
width: 55%;
|
17
17
|
height: 700px;
|
18
18
|
|
19
19
|
position: fixed;
|
@@ -34,8 +34,14 @@ body {
|
|
34
34
|
display: none;
|
35
35
|
}
|
36
36
|
|
37
|
+
#mocha {
|
38
|
+
width: 40%;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
37
42
|
@media (max-width: 1860px) {
|
38
43
|
.test-context {
|
44
|
+
width: 66%;
|
39
45
|
-webkit-transform: scale(0.6666666666);
|
40
46
|
-moz-transform: scale(0.6666666666);
|
41
47
|
-ms-transform: scale(0.6666666666);
|
@@ -46,6 +52,7 @@ body {
|
|
46
52
|
|
47
53
|
@media (max-width: 1550px) {
|
48
54
|
.test-context {
|
55
|
+
width: 100%;
|
49
56
|
-webkit-transform: scale(0.5);
|
50
57
|
-moz-transform: scale(0.5);
|
51
58
|
-ms-transform: scale(0.5);
|
@@ -56,6 +63,7 @@ body {
|
|
56
63
|
|
57
64
|
@media (max-width: 1230px) {
|
58
65
|
.test-context {
|
66
|
+
width: 150%;
|
59
67
|
-webkit-transform: scale(0.3333333333);
|
60
68
|
-moz-transform: scale(0.3333333333);
|
61
69
|
-ms-transform: scale(0.3333333333);
|
@@ -66,6 +74,7 @@ body {
|
|
66
74
|
|
67
75
|
@media (max-width: 1050px) {
|
68
76
|
.test-context {
|
77
|
+
width: 250%;
|
69
78
|
-webkit-transform: scale(0.2);
|
70
79
|
-moz-transform: scale(0.2);
|
71
80
|
-ms-transform: scale(0.2);
|
data/konacha.gemspec
CHANGED
@@ -17,7 +17,7 @@ the asset pipeline and engines.}
|
|
17
17
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
gem.name = "konacha"
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
gem.version = "3.
|
20
|
+
gem.version = "3.1.0"
|
21
21
|
gem.license = "MIT"
|
22
22
|
|
23
23
|
gem.add_dependency "railties", ">= 3.1", "< 5"
|
@@ -27,7 +27,7 @@ the asset pipeline and engines.}
|
|
27
27
|
gem.add_dependency "colorize"
|
28
28
|
|
29
29
|
gem.add_development_dependency "jquery-rails"
|
30
|
-
gem.add_development_dependency "rspec-rails", "~> 2.
|
30
|
+
gem.add_development_dependency "rspec-rails", "~> 2.14"
|
31
31
|
gem.add_development_dependency "capybara-firebug", "~> 1.1"
|
32
32
|
gem.add_development_dependency "coffee-script"
|
33
33
|
gem.add_development_dependency "ejs"
|
@@ -10,6 +10,9 @@ module Konacha
|
|
10
10
|
def initialize(data, parent)
|
11
11
|
@metadata = Metadata.new(data)
|
12
12
|
@parent = parent
|
13
|
+
if parent
|
14
|
+
update_metadata(example_group: parent.metadata)
|
15
|
+
end
|
13
16
|
end
|
14
17
|
|
15
18
|
delegate :full_description, :description, :location, :file_path, :line_number, :pending, :pending_message, :exception, :execution_result, :to => :metadata
|
@@ -29,6 +32,10 @@ module Konacha
|
|
29
32
|
def update_metadata(data)
|
30
33
|
metadata.update(data)
|
31
34
|
end
|
35
|
+
|
36
|
+
def [](key)
|
37
|
+
respond_to?(key) ? send(key) : metadata[key]
|
38
|
+
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
@@ -10,11 +10,15 @@ module Konacha
|
|
10
10
|
def initialize(data, parent)
|
11
11
|
@metadata = Metadata.new(data)
|
12
12
|
@parent = parent
|
13
|
+
if parent
|
14
|
+
update_metadata(example_group: parent.metadata)
|
15
|
+
end
|
13
16
|
end
|
14
17
|
|
15
18
|
delegate :full_description, :description, :file_path, :described_class, :to => :metadata
|
16
19
|
|
17
20
|
alias_method :display_name, :description
|
21
|
+
alias_method :example_group, :parent
|
18
22
|
|
19
23
|
def parent_groups
|
20
24
|
ancestor = parent
|
@@ -32,6 +36,10 @@ module Konacha
|
|
32
36
|
def update_metadata(data)
|
33
37
|
metadata.update(data)
|
34
38
|
end
|
39
|
+
|
40
|
+
def [](key)
|
41
|
+
respond_to?(key) ? send(key) : metadata[key]
|
42
|
+
end
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
@@ -6,9 +6,14 @@ describe Konacha::Reporter::ExampleGroup do
|
|
6
6
|
describe "#initialize" do
|
7
7
|
it "loads up a metadata instance and the parent" do
|
8
8
|
data = double('data')
|
9
|
-
|
10
|
-
|
9
|
+
parent_metadata = Konacha::Reporter::Metadata.new({})
|
10
|
+
parent = double('parent', metadata: parent_metadata)
|
11
|
+
|
12
|
+
# Check if parent metadata is added to metadata
|
13
|
+
described_class.any_instance.stub(:update_metadata) { nil }
|
14
|
+
described_class.any_instance.should_receive(:update_metadata).with(example_group: parent_metadata)
|
11
15
|
|
16
|
+
example_group = described_class.new(data, parent)
|
12
17
|
example_group.parent.should == parent
|
13
18
|
example_group.metadata.should be_a(Konacha::Reporter::Metadata)
|
14
19
|
example_group.metadata.data.should == data
|
@@ -61,4 +66,21 @@ describe Konacha::Reporter::ExampleGroup do
|
|
61
66
|
subject.update_metadata(data)
|
62
67
|
end
|
63
68
|
end
|
69
|
+
|
70
|
+
describe "#[]" do
|
71
|
+
it "should delegate to instance method if it exists" do
|
72
|
+
subject.stub(:some_method) { nil }
|
73
|
+
subject.stub(:metadata) { nil }
|
74
|
+
subject.should_receive(:some_method)
|
75
|
+
subject.should_not_receive(:metadata)
|
76
|
+
subject[:some_method]
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should delegate to metadata if no method exists" do
|
80
|
+
subject.should_not respond_to(:some_method)
|
81
|
+
subject.metadata.stub(:[]) { nil }
|
82
|
+
subject.metadata.should_receive(:[]).with(:some_method)
|
83
|
+
subject[:some_method]
|
84
|
+
end
|
85
|
+
end
|
64
86
|
end
|
@@ -6,9 +6,14 @@ describe Konacha::Reporter::Example do
|
|
6
6
|
describe "#initialize" do
|
7
7
|
it "loads up a metadata instance and the parent" do
|
8
8
|
data = double('data')
|
9
|
-
|
10
|
-
|
9
|
+
parent_metadata = Konacha::Reporter::Metadata.new({})
|
10
|
+
parent = double('parent', metadata: parent_metadata)
|
11
|
+
|
12
|
+
# Check if parent metadata is added to metadata
|
13
|
+
described_class.any_instance.stub(:update_metadata) { nil }
|
14
|
+
described_class.any_instance.should_receive(:update_metadata).with(example_group: parent_metadata)
|
11
15
|
|
16
|
+
example = described_class.new(data, parent)
|
12
17
|
example.parent.should == parent
|
13
18
|
example.metadata.should be_a(Konacha::Reporter::Metadata)
|
14
19
|
example.metadata.data.should == data
|
@@ -74,4 +79,21 @@ describe Konacha::Reporter::Example do
|
|
74
79
|
subject.update_metadata(data)
|
75
80
|
end
|
76
81
|
end
|
82
|
+
|
83
|
+
describe "#[]" do
|
84
|
+
it "should delegate to instance method if it exists" do
|
85
|
+
subject.stub(:some_method) { nil }
|
86
|
+
subject.stub(:metadata) { nil }
|
87
|
+
subject.should_receive(:some_method)
|
88
|
+
subject.should_not_receive(:metadata)
|
89
|
+
subject[:some_method]
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should delegate to metadata if no method exists" do
|
93
|
+
subject.should_not respond_to(:some_method)
|
94
|
+
subject.metadata.stub(:[]) { nil }
|
95
|
+
subject.metadata.should_receive(:[]).with(:some_method)
|
96
|
+
subject[:some_method]
|
97
|
+
end
|
98
|
+
end
|
77
99
|
end
|
data/spec/runner_spec.rb
CHANGED
@@ -140,7 +140,7 @@ describe Konacha::Runner do
|
|
140
140
|
subject.reporter.should_receive(:process_mocha_event).with(pass)
|
141
141
|
subject.reporter.should_receive(:process_mocha_event).with(pending)
|
142
142
|
subject.reporter.should_receive(:process_mocha_event).with(end_event)
|
143
|
-
subject.reporter.
|
143
|
+
subject.reporter.stub(:process_mocha_event)
|
144
144
|
subject.run
|
145
145
|
end
|
146
146
|
|
@@ -27,10 +27,14 @@ function require(path, parent, orig) {
|
|
27
27
|
// perform real require()
|
28
28
|
// by invoking the module's
|
29
29
|
// registered function
|
30
|
-
if (!module.exports) {
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
if (!module._resolving && !module.exports) {
|
31
|
+
var mod = {};
|
32
|
+
mod.exports = {};
|
33
|
+
mod.client = mod.component = true;
|
34
|
+
module._resolving = true;
|
35
|
+
module.call(this, mod.exports, require.relative(resolved), mod);
|
36
|
+
delete module._resolving;
|
37
|
+
module.exports = mod.exports;
|
34
38
|
}
|
35
39
|
|
36
40
|
return module.exports;
|
@@ -64,7 +68,6 @@ require.aliases = {};
|
|
64
68
|
|
65
69
|
require.resolve = function(path) {
|
66
70
|
if (path.charAt(0) === '/') path = path.slice(1);
|
67
|
-
var index = path + '/index.js';
|
68
71
|
|
69
72
|
var paths = [
|
70
73
|
path,
|
@@ -77,10 +80,7 @@ require.resolve = function(path) {
|
|
77
80
|
for (var i = 0; i < paths.length; i++) {
|
78
81
|
var path = paths[i];
|
79
82
|
if (require.modules.hasOwnProperty(path)) return path;
|
80
|
-
|
81
|
-
|
82
|
-
if (require.aliases.hasOwnProperty(index)) {
|
83
|
-
return require.aliases[index];
|
83
|
+
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
|
84
84
|
}
|
85
85
|
};
|
86
86
|
|
@@ -200,287 +200,745 @@ require.relative = function(parent) {
|
|
200
200
|
|
201
201
|
return localRequire;
|
202
202
|
};
|
203
|
-
require.register("
|
204
|
-
module.exports = require('./lib/chai');
|
205
|
-
|
206
|
-
});
|
207
|
-
require.register("chai/lib/chai.js", function(exports, require, module){
|
203
|
+
require.register("chaijs-assertion-error/index.js", function(exports, require, module){
|
208
204
|
/*!
|
209
|
-
*
|
210
|
-
* Copyright(c)
|
205
|
+
* assertion-error
|
206
|
+
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
211
207
|
* MIT Licensed
|
212
208
|
*/
|
213
209
|
|
214
|
-
|
215
|
-
|
210
|
+
/*!
|
211
|
+
* Return a function that will copy properties from
|
212
|
+
* one object to another excluding any originally
|
213
|
+
* listed. Returned function will create a new `{}`.
|
214
|
+
*
|
215
|
+
* @param {String} excluded properties ...
|
216
|
+
* @return {Function}
|
217
|
+
*/
|
218
|
+
|
219
|
+
function exclude () {
|
220
|
+
var excludes = [].slice.call(arguments);
|
221
|
+
|
222
|
+
function excludeProps (res, obj) {
|
223
|
+
Object.keys(obj).forEach(function (key) {
|
224
|
+
if (!~excludes.indexOf(key)) res[key] = obj[key];
|
225
|
+
});
|
226
|
+
}
|
227
|
+
|
228
|
+
return function extendExclude () {
|
229
|
+
var args = [].slice.call(arguments)
|
230
|
+
, i = 0
|
231
|
+
, res = {};
|
232
|
+
|
233
|
+
for (; i < args.length; i++) {
|
234
|
+
excludeProps(res, args[i]);
|
235
|
+
}
|
236
|
+
|
237
|
+
return res;
|
238
|
+
};
|
239
|
+
};
|
216
240
|
|
217
241
|
/*!
|
218
|
-
*
|
242
|
+
* Primary Exports
|
243
|
+
*/
|
244
|
+
|
245
|
+
module.exports = AssertionError;
|
246
|
+
|
247
|
+
/**
|
248
|
+
* ### AssertionError
|
249
|
+
*
|
250
|
+
* An extension of the JavaScript `Error` constructor for
|
251
|
+
* assertion and validation scenarios.
|
252
|
+
*
|
253
|
+
* @param {String} message
|
254
|
+
* @param {Object} properties to include (optional)
|
255
|
+
* @param {callee} start stack function (optional)
|
219
256
|
*/
|
220
257
|
|
221
|
-
|
258
|
+
function AssertionError (message, _props, ssf) {
|
259
|
+
var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
260
|
+
, props = extend(_props || {});
|
261
|
+
|
262
|
+
// default values
|
263
|
+
this.message = message || 'Unspecified AssertionError';
|
264
|
+
this.showDiff = false;
|
265
|
+
|
266
|
+
// copy from properties
|
267
|
+
for (var key in props) {
|
268
|
+
this[key] = props[key];
|
269
|
+
}
|
270
|
+
|
271
|
+
// capture stack trace
|
272
|
+
ssf = ssf || arguments.callee;
|
273
|
+
if (ssf && Error.captureStackTrace) {
|
274
|
+
Error.captureStackTrace(this, ssf);
|
275
|
+
}
|
276
|
+
}
|
222
277
|
|
223
278
|
/*!
|
224
|
-
*
|
279
|
+
* Inherit from Error.prototype
|
225
280
|
*/
|
226
281
|
|
227
|
-
|
282
|
+
AssertionError.prototype = Object.create(Error.prototype);
|
228
283
|
|
229
284
|
/*!
|
230
|
-
*
|
285
|
+
* Statically set name
|
231
286
|
*/
|
232
287
|
|
233
|
-
|
288
|
+
AssertionError.prototype.name = 'AssertionError';
|
234
289
|
|
235
290
|
/*!
|
236
|
-
*
|
291
|
+
* Ensure correct constructor
|
237
292
|
*/
|
238
293
|
|
239
|
-
|
294
|
+
AssertionError.prototype.constructor = AssertionError;
|
240
295
|
|
241
296
|
/**
|
242
|
-
*
|
297
|
+
* Allow errors to be converted to JSON for static transfer.
|
243
298
|
*
|
244
|
-
*
|
245
|
-
*
|
246
|
-
* @param {Function}
|
247
|
-
* @returns {this} for chaining
|
248
|
-
* @api public
|
299
|
+
* @param {Boolean} include stack (default: `true`)
|
300
|
+
* @return {Object} object that can be `JSON.stringify`
|
249
301
|
*/
|
250
302
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
303
|
+
AssertionError.prototype.toJSON = function (stack) {
|
304
|
+
var extend = exclude('constructor', 'toJSON', 'stack')
|
305
|
+
, props = extend({ name: this.name }, this);
|
306
|
+
|
307
|
+
// include stack if exists and not turned off
|
308
|
+
if (false !== stack && this.stack) {
|
309
|
+
props.stack = this.stack;
|
255
310
|
}
|
256
311
|
|
257
|
-
return
|
312
|
+
return props;
|
258
313
|
};
|
259
314
|
|
315
|
+
});
|
316
|
+
require.register("chaijs-type-detect/lib/type.js", function(exports, require, module){
|
260
317
|
/*!
|
261
|
-
*
|
318
|
+
* type-detect
|
319
|
+
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
320
|
+
* MIT Licensed
|
262
321
|
*/
|
263
322
|
|
264
|
-
var core = require('./chai/core/assertions');
|
265
|
-
exports.use(core);
|
266
|
-
|
267
323
|
/*!
|
268
|
-
*
|
324
|
+
* Primary Exports
|
269
325
|
*/
|
270
326
|
|
271
|
-
var
|
272
|
-
exports.use(expect);
|
327
|
+
var exports = module.exports = getType;
|
273
328
|
|
274
329
|
/*!
|
275
|
-
*
|
330
|
+
* Detectable javascript natives
|
276
331
|
*/
|
277
332
|
|
278
|
-
var
|
279
|
-
|
333
|
+
var natives = {
|
334
|
+
'[object Array]': 'array'
|
335
|
+
, '[object RegExp]': 'regexp'
|
336
|
+
, '[object Function]': 'function'
|
337
|
+
, '[object Arguments]': 'arguments'
|
338
|
+
, '[object Date]': 'date'
|
339
|
+
};
|
280
340
|
|
281
|
-
|
282
|
-
*
|
341
|
+
/**
|
342
|
+
* ### typeOf (obj)
|
343
|
+
*
|
344
|
+
* Use several different techniques to determine
|
345
|
+
* the type of object being tested.
|
346
|
+
*
|
347
|
+
*
|
348
|
+
* @param {Mixed} object
|
349
|
+
* @return {String} object type
|
350
|
+
* @api public
|
283
351
|
*/
|
284
352
|
|
285
|
-
|
286
|
-
|
353
|
+
function getType (obj) {
|
354
|
+
var str = Object.prototype.toString.call(obj);
|
355
|
+
if (natives[str]) return natives[str];
|
356
|
+
if (obj === null) return 'null';
|
357
|
+
if (obj === undefined) return 'undefined';
|
358
|
+
if (obj === Object(obj)) return 'object';
|
359
|
+
return typeof obj;
|
360
|
+
}
|
361
|
+
|
362
|
+
exports.Library = Library;
|
363
|
+
|
364
|
+
/**
|
365
|
+
* ### Library
|
366
|
+
*
|
367
|
+
* Create a repository for custom type detection.
|
368
|
+
*
|
369
|
+
* ```js
|
370
|
+
* var lib = new type.Library;
|
371
|
+
* ```
|
372
|
+
*
|
373
|
+
*/
|
374
|
+
|
375
|
+
function Library () {
|
376
|
+
this.tests = {};
|
377
|
+
}
|
378
|
+
|
379
|
+
/**
|
380
|
+
* #### .of (obj)
|
381
|
+
*
|
382
|
+
* Expose replacement `typeof` detection to the library.
|
383
|
+
*
|
384
|
+
* ```js
|
385
|
+
* if ('string' === lib.of('hello world')) {
|
386
|
+
* // ...
|
387
|
+
* }
|
388
|
+
* ```
|
389
|
+
*
|
390
|
+
* @param {Mixed} object to test
|
391
|
+
* @return {String} type
|
392
|
+
*/
|
393
|
+
|
394
|
+
Library.prototype.of = getType;
|
395
|
+
|
396
|
+
/**
|
397
|
+
* #### .define (type, test)
|
398
|
+
*
|
399
|
+
* Add a test to for the `.test()` assertion.
|
400
|
+
*
|
401
|
+
* Can be defined as a regular expression:
|
402
|
+
*
|
403
|
+
* ```js
|
404
|
+
* lib.define('int', /^[0-9]+$/);
|
405
|
+
* ```
|
406
|
+
*
|
407
|
+
* ... or as a function:
|
408
|
+
*
|
409
|
+
* ```js
|
410
|
+
* lib.define('bln', function (obj) {
|
411
|
+
* if ('boolean' === lib.of(obj)) return true;
|
412
|
+
* var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ];
|
413
|
+
* if ('string' === lib.of(obj)) obj = obj.toLowerCase();
|
414
|
+
* return !! ~blns.indexOf(obj);
|
415
|
+
* });
|
416
|
+
* ```
|
417
|
+
*
|
418
|
+
* @param {String} type
|
419
|
+
* @param {RegExp|Function} test
|
420
|
+
* @api public
|
421
|
+
*/
|
422
|
+
|
423
|
+
Library.prototype.define = function (type, test) {
|
424
|
+
if (arguments.length === 1) return this.tests[type];
|
425
|
+
this.tests[type] = test;
|
426
|
+
return this;
|
427
|
+
};
|
428
|
+
|
429
|
+
/**
|
430
|
+
* #### .test (obj, test)
|
431
|
+
*
|
432
|
+
* Assert that an object is of type. Will first
|
433
|
+
* check natives, and if that does not pass it will
|
434
|
+
* use the user defined custom tests.
|
435
|
+
*
|
436
|
+
* ```js
|
437
|
+
* assert(lib.test('1', 'int'));
|
438
|
+
* assert(lib.test('yes', 'bln'));
|
439
|
+
* ```
|
440
|
+
*
|
441
|
+
* @param {Mixed} object
|
442
|
+
* @param {String} type
|
443
|
+
* @return {Boolean} result
|
444
|
+
* @api public
|
445
|
+
*/
|
446
|
+
|
447
|
+
Library.prototype.test = function (obj, type) {
|
448
|
+
if (type === getType(obj)) return true;
|
449
|
+
var test = this.tests[type];
|
450
|
+
|
451
|
+
if (test && 'regexp' === getType(test)) {
|
452
|
+
return test.test(obj);
|
453
|
+
} else if (test && 'function' === getType(test)) {
|
454
|
+
return test(obj);
|
455
|
+
} else {
|
456
|
+
throw new ReferenceError('Type test "' + type + '" not defined or invalid.');
|
457
|
+
}
|
458
|
+
};
|
287
459
|
|
288
460
|
});
|
289
|
-
require.register("
|
461
|
+
require.register("chaijs-deep-eql/lib/eql.js", function(exports, require, module){
|
290
462
|
/*!
|
291
|
-
*
|
292
|
-
*
|
293
|
-
* Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
|
463
|
+
* deep-eql
|
464
|
+
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
294
465
|
* MIT Licensed
|
295
466
|
*/
|
296
467
|
|
297
468
|
/*!
|
298
|
-
* Module dependencies
|
469
|
+
* Module dependencies
|
299
470
|
*/
|
300
471
|
|
301
|
-
var
|
302
|
-
, util = require('./utils')
|
303
|
-
, flag = util.flag;
|
472
|
+
var type = require('type-detect');
|
304
473
|
|
305
474
|
/*!
|
306
|
-
*
|
475
|
+
* Buffer.isBuffer browser shim
|
307
476
|
*/
|
308
477
|
|
309
|
-
|
478
|
+
var Buffer;
|
479
|
+
try { Buffer = require('buffer').Buffer; }
|
480
|
+
catch(ex) {
|
481
|
+
Buffer = {};
|
482
|
+
Buffer.isBuffer = function() { return false; }
|
483
|
+
}
|
310
484
|
|
485
|
+
/*!
|
486
|
+
* Primary Export
|
487
|
+
*/
|
488
|
+
|
489
|
+
module.exports = deepEqual;
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Assert super-strict (egal) equality between
|
493
|
+
* two objects of any type.
|
494
|
+
*
|
495
|
+
* @param {Mixed} a
|
496
|
+
* @param {Mixed} b
|
497
|
+
* @param {Array} memoised (optional)
|
498
|
+
* @return {Boolean} equal match
|
499
|
+
*/
|
500
|
+
|
501
|
+
function deepEqual(a, b, m) {
|
502
|
+
if (sameValue(a, b)) {
|
503
|
+
return true;
|
504
|
+
} else if ('date' === type(a)) {
|
505
|
+
return dateEqual(a, b);
|
506
|
+
} else if ('regexp' === type(a)) {
|
507
|
+
return regexpEqual(a, b);
|
508
|
+
} else if (Buffer.isBuffer(a)) {
|
509
|
+
return bufferEqual(a, b);
|
510
|
+
} else if ('arguments' === type(a)) {
|
511
|
+
return argumentsEqual(a, b, m);
|
512
|
+
} else if (!typeEqual(a, b)) {
|
513
|
+
return false;
|
514
|
+
} else if (('object' !== type(a) && 'object' !== type(b))
|
515
|
+
&& ('array' !== type(a) && 'array' !== type(b))) {
|
516
|
+
return sameValue(a, b);
|
517
|
+
} else {
|
518
|
+
return objectEqual(a, b, m);
|
519
|
+
}
|
520
|
+
}
|
311
521
|
|
312
522
|
/*!
|
313
|
-
*
|
523
|
+
* Strict (egal) equality test. Ensures that NaN always
|
524
|
+
* equals NaN and `-0` does not equal `+0`.
|
314
525
|
*
|
315
|
-
*
|
526
|
+
* @param {Mixed} a
|
527
|
+
* @param {Mixed} b
|
528
|
+
* @return {Boolean} equal match
|
529
|
+
*/
|
530
|
+
|
531
|
+
function sameValue(a, b) {
|
532
|
+
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
533
|
+
return a !== a && b !== b;
|
534
|
+
}
|
535
|
+
|
536
|
+
/*!
|
537
|
+
* Compare the types of two given objects and
|
538
|
+
* return if they are equal. Note that an Array
|
539
|
+
* has a type of `array` (not `object`) and arguments
|
540
|
+
* have a type of `arguments` (not `array`/`object`).
|
316
541
|
*
|
317
|
-
* @
|
542
|
+
* @param {Mixed} a
|
543
|
+
* @param {Mixed} b
|
544
|
+
* @return {Boolean} result
|
318
545
|
*/
|
319
546
|
|
320
|
-
function
|
321
|
-
|
322
|
-
flag(this, 'object', obj);
|
323
|
-
flag(this, 'message', msg);
|
547
|
+
function typeEqual(a, b) {
|
548
|
+
return type(a) === type(b);
|
324
549
|
}
|
325
550
|
|
326
551
|
/*!
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
552
|
+
* Compare two Date objects by asserting that
|
553
|
+
* the time values are equal using `saveValue`.
|
554
|
+
*
|
555
|
+
* @param {Date} a
|
556
|
+
* @param {Date} b
|
557
|
+
* @return {Boolean} result
|
558
|
+
*/
|
559
|
+
|
560
|
+
function dateEqual(a, b) {
|
561
|
+
if ('date' !== type(b)) return false;
|
562
|
+
return sameValue(a.getTime(), b.getTime());
|
563
|
+
}
|
339
564
|
|
340
565
|
/*!
|
341
|
-
*
|
566
|
+
* Compare two regular expressions by converting them
|
567
|
+
* to string and checking for `sameValue`.
|
342
568
|
*
|
343
|
-
*
|
344
|
-
*
|
345
|
-
*
|
346
|
-
|
347
|
-
|
569
|
+
* @param {RegExp} a
|
570
|
+
* @param {RegExp} b
|
571
|
+
* @return {Boolean} result
|
572
|
+
*/
|
573
|
+
|
574
|
+
function regexpEqual(a, b) {
|
575
|
+
if ('regexp' !== type(b)) return false;
|
576
|
+
return sameValue(a.toString(), b.toString());
|
577
|
+
}
|
578
|
+
|
579
|
+
/*!
|
580
|
+
* Assert deep equality of two `arguments` objects.
|
581
|
+
* Unfortunately, these must be sliced to arrays
|
582
|
+
* prior to test to ensure no bad behavior.
|
348
583
|
*
|
349
|
-
* @
|
584
|
+
* @param {Arguments} a
|
585
|
+
* @param {Arguments} b
|
586
|
+
* @param {Array} memoize (optional)
|
587
|
+
* @return {Boolean} result
|
350
588
|
*/
|
351
589
|
|
352
|
-
|
590
|
+
function argumentsEqual(a, b, m) {
|
591
|
+
if ('arguments' !== type(b)) return false;
|
592
|
+
a = [].slice.call(a);
|
593
|
+
b = [].slice.call(b);
|
594
|
+
return deepEqual(a, b, m);
|
595
|
+
}
|
353
596
|
|
354
|
-
|
355
|
-
|
356
|
-
|
597
|
+
/*!
|
598
|
+
* Get enumerable properties of a given object.
|
599
|
+
*
|
600
|
+
* @param {Object} a
|
601
|
+
* @return {Array} property names
|
602
|
+
*/
|
357
603
|
|
358
|
-
|
359
|
-
|
360
|
-
|
604
|
+
function enumerable(a) {
|
605
|
+
var res = [];
|
606
|
+
for (var key in a) res.push(key);
|
607
|
+
return res;
|
608
|
+
}
|
361
609
|
|
362
|
-
|
363
|
-
|
364
|
-
|
610
|
+
/*!
|
611
|
+
* Simple equality for flat iterable objects
|
612
|
+
* such as Arrays or Node.js buffers.
|
613
|
+
*
|
614
|
+
* @param {Iterable} a
|
615
|
+
* @param {Iterable} b
|
616
|
+
* @return {Boolean} result
|
617
|
+
*/
|
365
618
|
|
366
|
-
|
367
|
-
|
368
|
-
};
|
619
|
+
function iterableEqual(a, b) {
|
620
|
+
if (a.length !== b.length) return false;
|
369
621
|
|
370
|
-
|
371
|
-
|
372
|
-
|
622
|
+
var i = 0;
|
623
|
+
var match = true;
|
624
|
+
|
625
|
+
for (; i < a.length; i++) {
|
626
|
+
if (a[i] !== b[i]) {
|
627
|
+
match = false;
|
628
|
+
break;
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
return match;
|
633
|
+
}
|
373
634
|
|
374
635
|
/*!
|
375
|
-
*
|
636
|
+
* Extension to `iterableEqual` specifically
|
637
|
+
* for Node.js Buffers.
|
376
638
|
*
|
377
|
-
*
|
378
|
-
*
|
379
|
-
* @
|
380
|
-
* @param {Philosophical} expression to be tested
|
381
|
-
* @param {String} message to display if fails
|
382
|
-
* @param {String} negatedMessage to display if negated expression fails
|
383
|
-
* @param {Mixed} expected value (remember to check for negation)
|
384
|
-
* @param {Mixed} actual (optional) will default to `this.obj`
|
385
|
-
* @api private
|
639
|
+
* @param {Buffer} a
|
640
|
+
* @param {Mixed} b
|
641
|
+
* @return {Boolean} result
|
386
642
|
*/
|
387
643
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
if (!ok) {
|
394
|
-
var msg = util.getMessage(this, arguments)
|
395
|
-
, actual = util.getActual(this, arguments);
|
396
|
-
throw new AssertionError({
|
397
|
-
message: msg
|
398
|
-
, actual: actual
|
399
|
-
, expected: expected
|
400
|
-
, stackStartFunction: (Assertion.includeStack) ? this.assert : flag(this, 'ssfi')
|
401
|
-
, showDiff: showDiff
|
402
|
-
});
|
403
|
-
}
|
404
|
-
};
|
644
|
+
function bufferEqual(a, b) {
|
645
|
+
if (!Buffer.isBuffer(b)) return false;
|
646
|
+
return iterableEqual(a, b);
|
647
|
+
}
|
405
648
|
|
406
649
|
/*!
|
407
|
-
*
|
650
|
+
* Block for `objectEqual` ensuring non-existing
|
651
|
+
* values don't get in.
|
408
652
|
*
|
409
|
-
*
|
653
|
+
* @param {Mixed} object
|
654
|
+
* @return {Boolean} result
|
655
|
+
*/
|
656
|
+
|
657
|
+
function isValue(a) {
|
658
|
+
return a !== null && a !== undefined;
|
659
|
+
}
|
660
|
+
|
661
|
+
/*!
|
662
|
+
* Recursively check the equality of two objects.
|
663
|
+
* Once basic sameness has been established it will
|
664
|
+
* defer to `deepEqual` for each enumerable key
|
665
|
+
* in the object.
|
410
666
|
*
|
411
|
-
* @
|
667
|
+
* @param {Mixed} a
|
668
|
+
* @param {Mixed} b
|
669
|
+
* @return {Boolean} result
|
412
670
|
*/
|
413
671
|
|
414
|
-
|
415
|
-
|
416
|
-
|
672
|
+
function objectEqual(a, b, m) {
|
673
|
+
if (!isValue(a) || !isValue(b)) {
|
674
|
+
return false;
|
675
|
+
}
|
676
|
+
|
677
|
+
if (a.prototype !== b.prototype) {
|
678
|
+
return false;
|
679
|
+
}
|
680
|
+
|
681
|
+
var i;
|
682
|
+
if (m) {
|
683
|
+
for (i = 0; i < m.length; i++) {
|
684
|
+
if ((m[i][0] === a && m[i][1] === b)
|
685
|
+
|| (m[i][0] === b && m[i][1] === a)) {
|
686
|
+
return true;
|
687
|
+
}
|
417
688
|
}
|
418
|
-
|
419
|
-
|
689
|
+
} else {
|
690
|
+
m = [];
|
691
|
+
}
|
692
|
+
|
693
|
+
try {
|
694
|
+
var ka = enumerable(a);
|
695
|
+
var kb = enumerable(b);
|
696
|
+
} catch (ex) {
|
697
|
+
return false;
|
698
|
+
}
|
699
|
+
|
700
|
+
ka.sort();
|
701
|
+
kb.sort();
|
702
|
+
|
703
|
+
if (!iterableEqual(ka, kb)) {
|
704
|
+
return false;
|
705
|
+
}
|
706
|
+
|
707
|
+
m.push([ a, b ]);
|
708
|
+
|
709
|
+
var key;
|
710
|
+
for (i = ka.length - 1; i >= 0; i--) {
|
711
|
+
key = ka[i];
|
712
|
+
if (!deepEqual(a[key], b[key], m)) {
|
713
|
+
return false;
|
420
714
|
}
|
715
|
+
}
|
716
|
+
|
717
|
+
return true;
|
718
|
+
}
|
719
|
+
|
421
720
|
});
|
721
|
+
require.register("chai/index.js", function(exports, require, module){
|
722
|
+
module.exports = require('./lib/chai');
|
422
723
|
|
423
724
|
});
|
424
|
-
require.register("chai/lib/chai
|
725
|
+
require.register("chai/lib/chai.js", function(exports, require, module){
|
425
726
|
/*!
|
426
727
|
* chai
|
427
|
-
* Copyright(c) 2011-
|
728
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
428
729
|
* MIT Licensed
|
429
730
|
*/
|
430
731
|
|
732
|
+
var used = []
|
733
|
+
, exports = module.exports = {};
|
734
|
+
|
431
735
|
/*!
|
432
|
-
*
|
736
|
+
* Chai version
|
433
737
|
*/
|
434
738
|
|
435
|
-
|
739
|
+
exports.version = '1.8.1';
|
740
|
+
|
741
|
+
/*!
|
742
|
+
* Assertion Error
|
743
|
+
*/
|
744
|
+
|
745
|
+
exports.AssertionError = require('assertion-error');
|
746
|
+
|
747
|
+
/*!
|
748
|
+
* Utils for plugins (not exported)
|
749
|
+
*/
|
750
|
+
|
751
|
+
var util = require('./chai/utils');
|
436
752
|
|
437
753
|
/**
|
438
|
-
* #
|
439
|
-
*
|
440
|
-
* Create a new assertion error based on the Javascript
|
441
|
-
* `Error` prototype.
|
754
|
+
* # .use(function)
|
442
755
|
*
|
443
|
-
*
|
444
|
-
* - message
|
445
|
-
* - actual
|
446
|
-
* - expected
|
447
|
-
* - operator
|
448
|
-
* - startStackFunction
|
756
|
+
* Provides a way to extend the internals of Chai
|
449
757
|
*
|
450
|
-
* @param {
|
758
|
+
* @param {Function}
|
759
|
+
* @returns {this} for chaining
|
451
760
|
* @api public
|
452
761
|
*/
|
453
762
|
|
454
|
-
function
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
this.expected = options.expected;
|
459
|
-
this.operator = options.operator;
|
460
|
-
this.showDiff = options.showDiff;
|
461
|
-
|
462
|
-
if (options.stackStartFunction && Error.captureStackTrace) {
|
463
|
-
var stackStartFunction = options.stackStartFunction;
|
464
|
-
Error.captureStackTrace(this, stackStartFunction);
|
763
|
+
exports.use = function (fn) {
|
764
|
+
if (!~used.indexOf(fn)) {
|
765
|
+
fn(this, util);
|
766
|
+
used.push(fn);
|
465
767
|
}
|
466
|
-
|
768
|
+
|
769
|
+
return this;
|
770
|
+
};
|
467
771
|
|
468
772
|
/*!
|
469
|
-
*
|
773
|
+
* Primary `Assertion` prototype
|
470
774
|
*/
|
471
775
|
|
472
|
-
|
473
|
-
|
474
|
-
AssertionError.prototype.constructor = AssertionError;
|
776
|
+
var assertion = require('./chai/assertion');
|
777
|
+
exports.use(assertion);
|
475
778
|
|
476
|
-
|
477
|
-
*
|
478
|
-
|
479
|
-
|
779
|
+
/*!
|
780
|
+
* Core Assertions
|
781
|
+
*/
|
782
|
+
|
783
|
+
var core = require('./chai/core/assertions');
|
784
|
+
exports.use(core);
|
785
|
+
|
786
|
+
/*!
|
787
|
+
* Expect interface
|
788
|
+
*/
|
789
|
+
|
790
|
+
var expect = require('./chai/interface/expect');
|
791
|
+
exports.use(expect);
|
792
|
+
|
793
|
+
/*!
|
794
|
+
* Should interface
|
480
795
|
*/
|
481
796
|
|
482
|
-
|
483
|
-
|
797
|
+
var should = require('./chai/interface/should');
|
798
|
+
exports.use(should);
|
799
|
+
|
800
|
+
/*!
|
801
|
+
* Assert interface
|
802
|
+
*/
|
803
|
+
|
804
|
+
var assert = require('./chai/interface/assert');
|
805
|
+
exports.use(assert);
|
806
|
+
|
807
|
+
});
|
808
|
+
require.register("chai/lib/chai/assertion.js", function(exports, require, module){
|
809
|
+
/*!
|
810
|
+
* chai
|
811
|
+
* http://chaijs.com
|
812
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
813
|
+
* MIT Licensed
|
814
|
+
*/
|
815
|
+
|
816
|
+
module.exports = function (_chai, util) {
|
817
|
+
/*!
|
818
|
+
* Module dependencies.
|
819
|
+
*/
|
820
|
+
|
821
|
+
var AssertionError = _chai.AssertionError
|
822
|
+
, flag = util.flag;
|
823
|
+
|
824
|
+
/*!
|
825
|
+
* Module export.
|
826
|
+
*/
|
827
|
+
|
828
|
+
_chai.Assertion = Assertion;
|
829
|
+
|
830
|
+
/*!
|
831
|
+
* Assertion Constructor
|
832
|
+
*
|
833
|
+
* Creates object for chaining.
|
834
|
+
*
|
835
|
+
* @api private
|
836
|
+
*/
|
837
|
+
|
838
|
+
function Assertion (obj, msg, stack) {
|
839
|
+
flag(this, 'ssfi', stack || arguments.callee);
|
840
|
+
flag(this, 'object', obj);
|
841
|
+
flag(this, 'message', msg);
|
842
|
+
}
|
843
|
+
|
844
|
+
/*!
|
845
|
+
* ### Assertion.includeStack
|
846
|
+
*
|
847
|
+
* User configurable property, influences whether stack trace
|
848
|
+
* is included in Assertion error message. Default of false
|
849
|
+
* suppresses stack trace in the error message
|
850
|
+
*
|
851
|
+
* Assertion.includeStack = true; // enable stack on error
|
852
|
+
*
|
853
|
+
* @api public
|
854
|
+
*/
|
855
|
+
|
856
|
+
Assertion.includeStack = false;
|
857
|
+
|
858
|
+
/*!
|
859
|
+
* ### Assertion.showDiff
|
860
|
+
*
|
861
|
+
* User configurable property, influences whether or not
|
862
|
+
* the `showDiff` flag should be included in the thrown
|
863
|
+
* AssertionErrors. `false` will always be `false`; `true`
|
864
|
+
* will be true when the assertion has requested a diff
|
865
|
+
* be shown.
|
866
|
+
*
|
867
|
+
* @api public
|
868
|
+
*/
|
869
|
+
|
870
|
+
Assertion.showDiff = true;
|
871
|
+
|
872
|
+
Assertion.addProperty = function (name, fn) {
|
873
|
+
util.addProperty(this.prototype, name, fn);
|
874
|
+
};
|
875
|
+
|
876
|
+
Assertion.addMethod = function (name, fn) {
|
877
|
+
util.addMethod(this.prototype, name, fn);
|
878
|
+
};
|
879
|
+
|
880
|
+
Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
881
|
+
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
882
|
+
};
|
883
|
+
|
884
|
+
Assertion.overwriteProperty = function (name, fn) {
|
885
|
+
util.overwriteProperty(this.prototype, name, fn);
|
886
|
+
};
|
887
|
+
|
888
|
+
Assertion.overwriteMethod = function (name, fn) {
|
889
|
+
util.overwriteMethod(this.prototype, name, fn);
|
890
|
+
};
|
891
|
+
|
892
|
+
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
893
|
+
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
894
|
+
};
|
895
|
+
|
896
|
+
/*!
|
897
|
+
* ### .assert(expression, message, negateMessage, expected, actual)
|
898
|
+
*
|
899
|
+
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
900
|
+
*
|
901
|
+
* @name assert
|
902
|
+
* @param {Philosophical} expression to be tested
|
903
|
+
* @param {String} message to display if fails
|
904
|
+
* @param {String} negatedMessage to display if negated expression fails
|
905
|
+
* @param {Mixed} expected value (remember to check for negation)
|
906
|
+
* @param {Mixed} actual (optional) will default to `this.obj`
|
907
|
+
* @api private
|
908
|
+
*/
|
909
|
+
|
910
|
+
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
911
|
+
var ok = util.test(this, arguments);
|
912
|
+
if (true !== showDiff) showDiff = false;
|
913
|
+
if (true !== Assertion.showDiff) showDiff = false;
|
914
|
+
|
915
|
+
if (!ok) {
|
916
|
+
var msg = util.getMessage(this, arguments)
|
917
|
+
, actual = util.getActual(this, arguments);
|
918
|
+
throw new AssertionError(msg, {
|
919
|
+
actual: actual
|
920
|
+
, expected: expected
|
921
|
+
, showDiff: showDiff
|
922
|
+
}, (Assertion.includeStack) ? this.assert : flag(this, 'ssfi'));
|
923
|
+
}
|
924
|
+
};
|
925
|
+
|
926
|
+
/*!
|
927
|
+
* ### ._obj
|
928
|
+
*
|
929
|
+
* Quick reference to stored `actual` value for plugin developers.
|
930
|
+
*
|
931
|
+
* @api private
|
932
|
+
*/
|
933
|
+
|
934
|
+
Object.defineProperty(Assertion.prototype, '_obj',
|
935
|
+
{ get: function () {
|
936
|
+
return flag(this, 'object');
|
937
|
+
}
|
938
|
+
, set: function (val) {
|
939
|
+
flag(this, 'object', val);
|
940
|
+
}
|
941
|
+
});
|
484
942
|
};
|
485
943
|
|
486
944
|
});
|
@@ -488,7 +946,7 @@ require.register("chai/lib/chai/core/assertions.js", function(exports, require,
|
|
488
946
|
/*!
|
489
947
|
* chai
|
490
948
|
* http://chaijs.com
|
491
|
-
* Copyright(c) 2011-
|
949
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
492
950
|
* MIT Licensed
|
493
951
|
*/
|
494
952
|
|
@@ -500,7 +958,7 @@ module.exports = function (chai, _) {
|
|
500
958
|
/**
|
501
959
|
* ### Language Chains
|
502
960
|
*
|
503
|
-
* The following are
|
961
|
+
* The following are provided as chainable getters to
|
504
962
|
* improve the readability of your assertions. They
|
505
963
|
* do not provide an testing capability unless they
|
506
964
|
* have been overwritten by a plugin.
|
@@ -513,6 +971,7 @@ module.exports = function (chai, _) {
|
|
513
971
|
* - is
|
514
972
|
* - that
|
515
973
|
* - and
|
974
|
+
* - has
|
516
975
|
* - have
|
517
976
|
* - with
|
518
977
|
* - at
|
@@ -524,7 +983,7 @@ module.exports = function (chai, _) {
|
|
524
983
|
*/
|
525
984
|
|
526
985
|
[ 'to', 'be', 'been'
|
527
|
-
, 'is', 'and', 'have'
|
986
|
+
, 'is', 'and', 'has', 'have'
|
528
987
|
, 'with', 'that', 'at'
|
529
988
|
, 'of', 'same' ].forEach(function (chain) {
|
530
989
|
Assertion.addProperty(chain, function () {
|
@@ -632,9 +1091,21 @@ module.exports = function (chai, _) {
|
|
632
1091
|
|
633
1092
|
function include (val, msg) {
|
634
1093
|
if (msg) flag(this, 'message', msg);
|
635
|
-
var obj = flag(this, 'object')
|
1094
|
+
var obj = flag(this, 'object');
|
1095
|
+
|
1096
|
+
if (_.type(val) === 'object') {
|
1097
|
+
if (!flag(this, 'negate')) {
|
1098
|
+
for (var k in val) new Assertion(obj).property(k, val[k]);
|
1099
|
+
return;
|
1100
|
+
}
|
1101
|
+
var subset = {}
|
1102
|
+
for (var k in val) subset[k] = obj[k]
|
1103
|
+
var expected = _.eql(subset, val);
|
1104
|
+
} else {
|
1105
|
+
var expected = obj && ~obj.indexOf(val)
|
1106
|
+
}
|
636
1107
|
this.assert(
|
637
|
-
|
1108
|
+
expected
|
638
1109
|
, 'expected #{this} to include ' + _.inspect(val)
|
639
1110
|
, 'expected #{this} to not include ' + _.inspect(val));
|
640
1111
|
}
|
@@ -731,8 +1202,8 @@ module.exports = function (chai, _) {
|
|
731
1202
|
*
|
732
1203
|
* Asserts that the target is `undefined`.
|
733
1204
|
*
|
734
|
-
*
|
735
|
-
*
|
1205
|
+
* expect(undefined).to.be.undefined;
|
1206
|
+
* expect(null).to.not.be.undefined;
|
736
1207
|
*
|
737
1208
|
* @name undefined
|
738
1209
|
* @api public
|
@@ -1489,6 +1960,7 @@ module.exports = function (chai, _) {
|
|
1489
1960
|
* @param {String|RegExp} expected error message
|
1490
1961
|
* @param {String} message _optional_
|
1491
1962
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
1963
|
+
* @returns error for chaining (null if no error)
|
1492
1964
|
* @api public
|
1493
1965
|
*/
|
1494
1966
|
|
@@ -1513,7 +1985,10 @@ module.exports = function (chai, _) {
|
|
1513
1985
|
constructor = null;
|
1514
1986
|
errMsg = null;
|
1515
1987
|
} else if (typeof constructor === 'function') {
|
1516
|
-
name =
|
1988
|
+
name = constructor.prototype.name || constructor.name;
|
1989
|
+
if (name === 'Error' && constructor !== Error) {
|
1990
|
+
name = (new constructor()).name;
|
1991
|
+
}
|
1517
1992
|
} else {
|
1518
1993
|
constructor = null;
|
1519
1994
|
}
|
@@ -1527,12 +2002,14 @@ module.exports = function (chai, _) {
|
|
1527
2002
|
err === desiredError
|
1528
2003
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1529
2004
|
, 'expected #{this} to not throw #{exp}'
|
1530
|
-
, desiredError
|
1531
|
-
, err
|
2005
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2006
|
+
, (err instanceof Error ? err.toString() : err)
|
1532
2007
|
);
|
1533
2008
|
|
2009
|
+
flag(this, 'object', err);
|
1534
2010
|
return this;
|
1535
2011
|
}
|
2012
|
+
|
1536
2013
|
// next, check constructor
|
1537
2014
|
if (constructor) {
|
1538
2015
|
this.assert(
|
@@ -1540,11 +2017,15 @@ module.exports = function (chai, _) {
|
|
1540
2017
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1541
2018
|
, 'expected #{this} to not throw #{exp} but #{act} was thrown'
|
1542
2019
|
, name
|
1543
|
-
, err
|
2020
|
+
, (err instanceof Error ? err.toString() : err)
|
1544
2021
|
);
|
1545
2022
|
|
1546
|
-
if (!errMsg)
|
2023
|
+
if (!errMsg) {
|
2024
|
+
flag(this, 'object', err);
|
2025
|
+
return this;
|
2026
|
+
}
|
1547
2027
|
}
|
2028
|
+
|
1548
2029
|
// next, check message
|
1549
2030
|
var message = 'object' === _.type(err) && "message" in err
|
1550
2031
|
? err.message
|
@@ -1559,6 +2040,7 @@ module.exports = function (chai, _) {
|
|
1559
2040
|
, message
|
1560
2041
|
);
|
1561
2042
|
|
2043
|
+
flag(this, 'object', err);
|
1562
2044
|
return this;
|
1563
2045
|
} else if ((message != null) && errMsg && 'string' === typeof errMsg) {
|
1564
2046
|
this.assert(
|
@@ -1569,6 +2051,7 @@ module.exports = function (chai, _) {
|
|
1569
2051
|
, message
|
1570
2052
|
);
|
1571
2053
|
|
2054
|
+
flag(this, 'object', err);
|
1572
2055
|
return this;
|
1573
2056
|
} else {
|
1574
2057
|
thrown = true;
|
@@ -1591,9 +2074,11 @@ module.exports = function (chai, _) {
|
|
1591
2074
|
thrown === true
|
1592
2075
|
, 'expected #{this} to throw ' + expectedThrown + actuallyGot
|
1593
2076
|
, 'expected #{this} to not throw ' + expectedThrown + actuallyGot
|
1594
|
-
, desiredError
|
1595
|
-
, thrownError
|
2077
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2078
|
+
, (thrownError instanceof Error ? thrownError.toString() : thrownError)
|
1596
2079
|
);
|
2080
|
+
|
2081
|
+
flag(this, 'object', thrownError);
|
1597
2082
|
};
|
1598
2083
|
|
1599
2084
|
Assertion.addMethod('throw', assertThrows);
|
@@ -1612,8 +2097,8 @@ module.exports = function (chai, _) {
|
|
1612
2097
|
* To check if a constructor will respond to a static function,
|
1613
2098
|
* set the `itself` flag.
|
1614
2099
|
*
|
1615
|
-
*
|
1616
|
-
*
|
2100
|
+
* Klass.baz = function(){};
|
2101
|
+
* expect(Klass).itself.to.respondTo('baz');
|
1617
2102
|
*
|
1618
2103
|
* @name respondTo
|
1619
2104
|
* @param {String} method
|
@@ -1641,12 +2126,12 @@ module.exports = function (chai, _) {
|
|
1641
2126
|
*
|
1642
2127
|
* Sets the `itself` flag, later used by the `respondTo` assertion.
|
1643
2128
|
*
|
1644
|
-
*
|
1645
|
-
*
|
1646
|
-
*
|
2129
|
+
* function Foo() {}
|
2130
|
+
* Foo.bar = function() {}
|
2131
|
+
* Foo.prototype.baz = function() {}
|
1647
2132
|
*
|
1648
|
-
*
|
1649
|
-
*
|
2133
|
+
* expect(Foo).itself.to.respondTo('bar');
|
2134
|
+
* expect(Foo).itself.not.to.respondTo('baz');
|
1650
2135
|
*
|
1651
2136
|
* @name itself
|
1652
2137
|
* @api public
|
@@ -1712,16 +2197,16 @@ module.exports = function (chai, _) {
|
|
1712
2197
|
}
|
1713
2198
|
|
1714
2199
|
/**
|
1715
|
-
* ### .members
|
2200
|
+
* ### .members(set)
|
1716
2201
|
*
|
1717
2202
|
* Asserts that the target is a superset of `set`,
|
1718
2203
|
* or that the target and `set` have the same members.
|
1719
2204
|
*
|
1720
|
-
*
|
1721
|
-
*
|
2205
|
+
* expect([1, 2, 3]).to.include.members([3, 2]);
|
2206
|
+
* expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
|
1722
2207
|
*
|
1723
|
-
*
|
1724
|
-
*
|
2208
|
+
* expect([4, 2]).to.have.members([2, 4]);
|
2209
|
+
* expect([5, 2]).to.not.have.members([5, 2, 1]);
|
1725
2210
|
*
|
1726
2211
|
* @name members
|
1727
2212
|
* @param {Array} set
|
@@ -1760,7 +2245,7 @@ module.exports = function (chai, _) {
|
|
1760
2245
|
require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){
|
1761
2246
|
/*!
|
1762
2247
|
* chai
|
1763
|
-
* Copyright(c) 2011-
|
2248
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
1764
2249
|
* MIT Licensed
|
1765
2250
|
*/
|
1766
2251
|
|
@@ -1815,13 +2300,12 @@ module.exports = function (chai, util) {
|
|
1815
2300
|
*/
|
1816
2301
|
|
1817
2302
|
assert.fail = function (actual, expected, message, operator) {
|
1818
|
-
|
2303
|
+
message = message || 'assert.fail()';
|
2304
|
+
throw new chai.AssertionError(message, {
|
1819
2305
|
actual: actual
|
1820
2306
|
, expected: expected
|
1821
|
-
, message: message
|
1822
2307
|
, operator: operator
|
1823
|
-
|
1824
|
-
});
|
2308
|
+
}, assert.fail);
|
1825
2309
|
};
|
1826
2310
|
|
1827
2311
|
/**
|
@@ -1842,6 +2326,24 @@ module.exports = function (chai, util) {
|
|
1842
2326
|
new Assertion(val, msg).is.ok;
|
1843
2327
|
};
|
1844
2328
|
|
2329
|
+
/**
|
2330
|
+
* ### .notOk(object, [message])
|
2331
|
+
*
|
2332
|
+
* Asserts that `object` is falsy.
|
2333
|
+
*
|
2334
|
+
* assert.notOk('everything', 'this will fail');
|
2335
|
+
* assert.notOk(false, 'this will pass');
|
2336
|
+
*
|
2337
|
+
* @name notOk
|
2338
|
+
* @param {Mixed} object to test
|
2339
|
+
* @param {String} message
|
2340
|
+
* @api public
|
2341
|
+
*/
|
2342
|
+
|
2343
|
+
assert.notOk = function (val, msg) {
|
2344
|
+
new Assertion(val, msg).is.not.ok;
|
2345
|
+
};
|
2346
|
+
|
1845
2347
|
/**
|
1846
2348
|
* ### .equal(actual, expected, [message])
|
1847
2349
|
*
|
@@ -2063,7 +2565,7 @@ module.exports = function (chai, util) {
|
|
2063
2565
|
* var tea = 'cup of chai';
|
2064
2566
|
* assert.isDefined(tea, 'tea has been defined');
|
2065
2567
|
*
|
2066
|
-
* @name
|
2568
|
+
* @name isDefined
|
2067
2569
|
* @param {Mixed} value
|
2068
2570
|
* @param {String} message
|
2069
2571
|
* @api public
|
@@ -2399,18 +2901,7 @@ module.exports = function (chai, util) {
|
|
2399
2901
|
*/
|
2400
2902
|
|
2401
2903
|
assert.include = function (exp, inc, msg) {
|
2402
|
-
|
2403
|
-
|
2404
|
-
if (Array.isArray(exp)) {
|
2405
|
-
obj.to.include(inc);
|
2406
|
-
} else if ('string' === typeof exp) {
|
2407
|
-
obj.to.contain.string(inc);
|
2408
|
-
} else {
|
2409
|
-
throw new chai.AssertionError({
|
2410
|
-
message: 'expected an array or string'
|
2411
|
-
, stackStartFunction: assert.include
|
2412
|
-
});
|
2413
|
-
}
|
2904
|
+
new Assertion(exp, msg).include(inc);
|
2414
2905
|
};
|
2415
2906
|
|
2416
2907
|
/**
|
@@ -2430,18 +2921,7 @@ module.exports = function (chai, util) {
|
|
2430
2921
|
*/
|
2431
2922
|
|
2432
2923
|
assert.notInclude = function (exp, inc, msg) {
|
2433
|
-
|
2434
|
-
|
2435
|
-
if (Array.isArray(exp)) {
|
2436
|
-
obj.to.not.include(inc);
|
2437
|
-
} else if ('string' === typeof exp) {
|
2438
|
-
obj.to.not.contain.string(inc);
|
2439
|
-
} else {
|
2440
|
-
throw new chai.AssertionError({
|
2441
|
-
message: 'expected an array or string'
|
2442
|
-
, stackStartFunction: assert.include
|
2443
|
-
});
|
2444
|
-
}
|
2924
|
+
new Assertion(exp, msg).not.include(inc);
|
2445
2925
|
};
|
2446
2926
|
|
2447
2927
|
/**
|
@@ -2685,7 +3165,8 @@ module.exports = function (chai, util) {
|
|
2685
3165
|
errt = null;
|
2686
3166
|
}
|
2687
3167
|
|
2688
|
-
new Assertion(fn, msg).to.Throw(errt, errs);
|
3168
|
+
var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
|
3169
|
+
return flag(assertErr, 'object');
|
2689
3170
|
};
|
2690
3171
|
|
2691
3172
|
/**
|
@@ -2823,7 +3304,7 @@ module.exports = function (chai, util) {
|
|
2823
3304
|
require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){
|
2824
3305
|
/*!
|
2825
3306
|
* chai
|
2826
|
-
* Copyright(c) 2011-
|
3307
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
2827
3308
|
* MIT Licensed
|
2828
3309
|
*/
|
2829
3310
|
|
@@ -2838,7 +3319,7 @@ module.exports = function (chai, util) {
|
|
2838
3319
|
require.register("chai/lib/chai/interface/should.js", function(exports, require, module){
|
2839
3320
|
/*!
|
2840
3321
|
* chai
|
2841
|
-
* Copyright(c) 2011-
|
3322
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
2842
3323
|
* MIT Licensed
|
2843
3324
|
*/
|
2844
3325
|
|
@@ -2917,7 +3398,7 @@ module.exports = function (chai, util) {
|
|
2917
3398
|
require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){
|
2918
3399
|
/*!
|
2919
3400
|
* Chai - addChainingMethod utility
|
2920
|
-
* Copyright(c) 2012-
|
3401
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
2921
3402
|
* MIT Licensed
|
2922
3403
|
*/
|
2923
3404
|
|
@@ -2972,15 +3453,27 @@ var call = Function.prototype.call,
|
|
2972
3453
|
*/
|
2973
3454
|
|
2974
3455
|
module.exports = function (ctx, name, method, chainingBehavior) {
|
2975
|
-
if (typeof chainingBehavior !== 'function')
|
3456
|
+
if (typeof chainingBehavior !== 'function') {
|
2976
3457
|
chainingBehavior = function () { };
|
3458
|
+
}
|
3459
|
+
|
3460
|
+
var chainableBehavior = {
|
3461
|
+
method: method
|
3462
|
+
, chainingBehavior: chainingBehavior
|
3463
|
+
};
|
3464
|
+
|
3465
|
+
// save the methods so we can overwrite them later, if we need to.
|
3466
|
+
if (!ctx.__methods) {
|
3467
|
+
ctx.__methods = {};
|
3468
|
+
}
|
3469
|
+
ctx.__methods[name] = chainableBehavior;
|
2977
3470
|
|
2978
3471
|
Object.defineProperty(ctx, name,
|
2979
3472
|
{ get: function () {
|
2980
|
-
chainingBehavior.call(this);
|
3473
|
+
chainableBehavior.chainingBehavior.call(this);
|
2981
3474
|
|
2982
3475
|
var assert = function () {
|
2983
|
-
var result = method.apply(this, arguments);
|
3476
|
+
var result = chainableBehavior.method.apply(this, arguments);
|
2984
3477
|
return result === undefined ? this : result;
|
2985
3478
|
};
|
2986
3479
|
|
@@ -3014,7 +3507,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
3014
3507
|
require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){
|
3015
3508
|
/*!
|
3016
3509
|
* Chai - addMethod utility
|
3017
|
-
* Copyright(c) 2012-
|
3510
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3018
3511
|
* MIT Licensed
|
3019
3512
|
*/
|
3020
3513
|
|
@@ -3054,7 +3547,7 @@ module.exports = function (ctx, name, method) {
|
|
3054
3547
|
require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){
|
3055
3548
|
/*!
|
3056
3549
|
* Chai - addProperty utility
|
3057
|
-
* Copyright(c) 2012-
|
3550
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3058
3551
|
* MIT Licensed
|
3059
3552
|
*/
|
3060
3553
|
|
@@ -3093,138 +3586,11 @@ module.exports = function (ctx, name, getter) {
|
|
3093
3586
|
});
|
3094
3587
|
};
|
3095
3588
|
|
3096
|
-
});
|
3097
|
-
require.register("chai/lib/chai/utils/eql.js", function(exports, require, module){
|
3098
|
-
// This is (almost) directly from Node.js assert
|
3099
|
-
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js
|
3100
|
-
|
3101
|
-
module.exports = _deepEqual;
|
3102
|
-
|
3103
|
-
var getEnumerableProperties = require('./getEnumerableProperties');
|
3104
|
-
|
3105
|
-
// for the browser
|
3106
|
-
var Buffer;
|
3107
|
-
try {
|
3108
|
-
Buffer = require('buffer').Buffer;
|
3109
|
-
} catch (ex) {
|
3110
|
-
Buffer = {
|
3111
|
-
isBuffer: function () { return false; }
|
3112
|
-
};
|
3113
|
-
}
|
3114
|
-
|
3115
|
-
function _deepEqual(actual, expected, memos) {
|
3116
|
-
|
3117
|
-
// 7.1. All identical values are equivalent, as determined by ===.
|
3118
|
-
if (actual === expected) {
|
3119
|
-
return true;
|
3120
|
-
|
3121
|
-
} else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
|
3122
|
-
if (actual.length != expected.length) return false;
|
3123
|
-
|
3124
|
-
for (var i = 0; i < actual.length; i++) {
|
3125
|
-
if (actual[i] !== expected[i]) return false;
|
3126
|
-
}
|
3127
|
-
|
3128
|
-
return true;
|
3129
|
-
|
3130
|
-
// 7.2. If the expected value is a Date object, the actual value is
|
3131
|
-
// equivalent if it is also a Date object that refers to the same time.
|
3132
|
-
} else if (actual instanceof Date && expected instanceof Date) {
|
3133
|
-
return actual.getTime() === expected.getTime();
|
3134
|
-
|
3135
|
-
// 7.3. Other pairs that do not both pass typeof value == 'object',
|
3136
|
-
// equivalence is determined by ==.
|
3137
|
-
} else if (typeof actual != 'object' && typeof expected != 'object') {
|
3138
|
-
return actual === expected;
|
3139
|
-
|
3140
|
-
// 7.4. For all other Object pairs, including Array objects, equivalence is
|
3141
|
-
// determined by having the same number of owned properties (as verified
|
3142
|
-
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
3143
|
-
// (although not necessarily the same order), equivalent values for every
|
3144
|
-
// corresponding key, and an identical 'prototype' property. Note: this
|
3145
|
-
// accounts for both named and indexed properties on Arrays.
|
3146
|
-
} else {
|
3147
|
-
return objEquiv(actual, expected, memos);
|
3148
|
-
}
|
3149
|
-
}
|
3150
|
-
|
3151
|
-
function isUndefinedOrNull(value) {
|
3152
|
-
return value === null || value === undefined;
|
3153
|
-
}
|
3154
|
-
|
3155
|
-
function isArguments(object) {
|
3156
|
-
return Object.prototype.toString.call(object) == '[object Arguments]';
|
3157
|
-
}
|
3158
|
-
|
3159
|
-
function objEquiv(a, b, memos) {
|
3160
|
-
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
3161
|
-
return false;
|
3162
|
-
|
3163
|
-
// an identical 'prototype' property.
|
3164
|
-
if (a.prototype !== b.prototype) return false;
|
3165
|
-
|
3166
|
-
// check if we have already compared a and b
|
3167
|
-
var i;
|
3168
|
-
if (memos) {
|
3169
|
-
for(i = 0; i < memos.length; i++) {
|
3170
|
-
if ((memos[i][0] === a && memos[i][1] === b) ||
|
3171
|
-
(memos[i][0] === b && memos[i][1] === a))
|
3172
|
-
return true;
|
3173
|
-
}
|
3174
|
-
} else {
|
3175
|
-
memos = [];
|
3176
|
-
}
|
3177
|
-
|
3178
|
-
//~~~I've managed to break Object.keys through screwy arguments passing.
|
3179
|
-
// Converting to array solves the problem.
|
3180
|
-
if (isArguments(a)) {
|
3181
|
-
if (!isArguments(b)) {
|
3182
|
-
return false;
|
3183
|
-
}
|
3184
|
-
a = pSlice.call(a);
|
3185
|
-
b = pSlice.call(b);
|
3186
|
-
return _deepEqual(a, b, memos);
|
3187
|
-
}
|
3188
|
-
try {
|
3189
|
-
var ka = getEnumerableProperties(a),
|
3190
|
-
kb = getEnumerableProperties(b),
|
3191
|
-
key;
|
3192
|
-
} catch (e) {//happens when one is a string literal and the other isn't
|
3193
|
-
return false;
|
3194
|
-
}
|
3195
|
-
|
3196
|
-
// having the same number of owned properties (keys incorporates
|
3197
|
-
// hasOwnProperty)
|
3198
|
-
if (ka.length != kb.length)
|
3199
|
-
return false;
|
3200
|
-
|
3201
|
-
//the same set of keys (although not necessarily the same order),
|
3202
|
-
ka.sort();
|
3203
|
-
kb.sort();
|
3204
|
-
//~~~cheap key test
|
3205
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
3206
|
-
if (ka[i] != kb[i])
|
3207
|
-
return false;
|
3208
|
-
}
|
3209
|
-
|
3210
|
-
// remember objects we have compared to guard against circular references
|
3211
|
-
memos.push([ a, b ]);
|
3212
|
-
|
3213
|
-
//equivalent values for every corresponding key, and
|
3214
|
-
//~~~possibly expensive deep test
|
3215
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
3216
|
-
key = ka[i];
|
3217
|
-
if (!_deepEqual(a[key], b[key], memos)) return false;
|
3218
|
-
}
|
3219
|
-
|
3220
|
-
return true;
|
3221
|
-
}
|
3222
|
-
|
3223
3589
|
});
|
3224
3590
|
require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){
|
3225
3591
|
/*!
|
3226
3592
|
* Chai - flag utility
|
3227
|
-
* Copyright(c) 2012-
|
3593
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3228
3594
|
* MIT Licensed
|
3229
3595
|
*/
|
3230
3596
|
|
@@ -3259,7 +3625,7 @@ module.exports = function (obj, key, value) {
|
|
3259
3625
|
require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){
|
3260
3626
|
/*!
|
3261
3627
|
* Chai - getActual utility
|
3262
|
-
* Copyright(c) 2012-
|
3628
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3263
3629
|
* MIT Licensed
|
3264
3630
|
*/
|
3265
3631
|
|
@@ -3281,7 +3647,7 @@ module.exports = function (obj, args) {
|
|
3281
3647
|
require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){
|
3282
3648
|
/*!
|
3283
3649
|
* Chai - getEnumerableProperties utility
|
3284
|
-
* Copyright(c) 2012-
|
3650
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3285
3651
|
* MIT Licensed
|
3286
3652
|
*/
|
3287
3653
|
|
@@ -3309,7 +3675,7 @@ module.exports = function getEnumerableProperties(object) {
|
|
3309
3675
|
require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){
|
3310
3676
|
/*!
|
3311
3677
|
* Chai - message composition utility
|
3312
|
-
* Copyright(c) 2012-
|
3678
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3313
3679
|
* MIT Licensed
|
3314
3680
|
*/
|
3315
3681
|
|
@@ -3329,7 +3695,7 @@ var flag = require('./flag')
|
|
3329
3695
|
* and template tags. Template tags will return
|
3330
3696
|
* a stringified inspection of the object referenced.
|
3331
3697
|
*
|
3332
|
-
*
|
3698
|
+
* Message template tags:
|
3333
3699
|
* - `#{this}` current asserted object
|
3334
3700
|
* - `#{act}` actual value
|
3335
3701
|
* - `#{exp}` expected value
|
@@ -3361,7 +3727,7 @@ module.exports = function (obj, args) {
|
|
3361
3727
|
require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){
|
3362
3728
|
/*!
|
3363
3729
|
* Chai - getName utility
|
3364
|
-
* Copyright(c) 2012-
|
3730
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3365
3731
|
* MIT Licensed
|
3366
3732
|
*/
|
3367
3733
|
|
@@ -3384,7 +3750,7 @@ module.exports = function (func) {
|
|
3384
3750
|
require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){
|
3385
3751
|
/*!
|
3386
3752
|
* Chai - getPathValue utility
|
3387
|
-
* Copyright(c) 2012-
|
3753
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3388
3754
|
* @see https://github.com/logicalparadox/filtr
|
3389
3755
|
* MIT Licensed
|
3390
3756
|
*/
|
@@ -3489,7 +3855,7 @@ function _getPathValue (parsed, obj) {
|
|
3489
3855
|
require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){
|
3490
3856
|
/*!
|
3491
3857
|
* Chai - getProperties utility
|
3492
|
-
* Copyright(c) 2012-
|
3858
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3493
3859
|
* MIT Licensed
|
3494
3860
|
*/
|
3495
3861
|
|
@@ -3589,7 +3955,7 @@ exports.transferFlags = require('./transferFlags');
|
|
3589
3955
|
* Deep equal utility
|
3590
3956
|
*/
|
3591
3957
|
|
3592
|
-
exports.eql = require('
|
3958
|
+
exports.eql = require('deep-eql');
|
3593
3959
|
|
3594
3960
|
/*!
|
3595
3961
|
* Deep path value
|
@@ -3633,6 +3999,12 @@ exports.overwriteMethod = require('./overwriteMethod');
|
|
3633
3999
|
|
3634
4000
|
exports.addChainableMethod = require('./addChainableMethod');
|
3635
4001
|
|
4002
|
+
/*!
|
4003
|
+
* Overwrite chainable method
|
4004
|
+
*/
|
4005
|
+
|
4006
|
+
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
4007
|
+
|
3636
4008
|
|
3637
4009
|
});
|
3638
4010
|
require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){
|
@@ -3703,7 +4075,11 @@ function formatValue(ctx, value, recurseTimes) {
|
|
3703
4075
|
value.inspect !== exports.inspect &&
|
3704
4076
|
// Also filter out any prototype objects using the circular check.
|
3705
4077
|
!(value.constructor && value.constructor.prototype === value)) {
|
3706
|
-
|
4078
|
+
var ret = value.inspect(recurseTimes);
|
4079
|
+
if (typeof ret !== 'string') {
|
4080
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
4081
|
+
}
|
4082
|
+
return ret;
|
3707
4083
|
}
|
3708
4084
|
|
3709
4085
|
// Primitive types cannot have properties
|
@@ -3957,7 +4333,7 @@ function objectToString(o) {
|
|
3957
4333
|
require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){
|
3958
4334
|
/*!
|
3959
4335
|
* Chai - flag utility
|
3960
|
-
* Copyright(c) 2012-
|
4336
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3961
4337
|
* MIT Licensed
|
3962
4338
|
*/
|
3963
4339
|
|
@@ -4008,7 +4384,7 @@ module.exports = function (obj) {
|
|
4008
4384
|
require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){
|
4009
4385
|
/*!
|
4010
4386
|
* Chai - overwriteMethod utility
|
4011
|
-
* Copyright(c) 2012-
|
4387
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4012
4388
|
* MIT Licensed
|
4013
4389
|
*/
|
4014
4390
|
|
@@ -4062,7 +4438,7 @@ module.exports = function (ctx, name, method) {
|
|
4062
4438
|
require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){
|
4063
4439
|
/*!
|
4064
4440
|
* Chai - overwriteProperty utility
|
4065
|
-
* Copyright(c) 2012-
|
4441
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4066
4442
|
* MIT Licensed
|
4067
4443
|
*/
|
4068
4444
|
|
@@ -4115,11 +4491,67 @@ module.exports = function (ctx, name, getter) {
|
|
4115
4491
|
});
|
4116
4492
|
};
|
4117
4493
|
|
4494
|
+
});
|
4495
|
+
require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function(exports, require, module){
|
4496
|
+
/*!
|
4497
|
+
* Chai - overwriteChainableMethod utility
|
4498
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4499
|
+
* MIT Licensed
|
4500
|
+
*/
|
4501
|
+
|
4502
|
+
/**
|
4503
|
+
* ### overwriteChainableMethod (ctx, name, fn)
|
4504
|
+
*
|
4505
|
+
* Overwites an already existing chainable method
|
4506
|
+
* and provides access to the previous function or
|
4507
|
+
* property. Must return functions to be used for
|
4508
|
+
* name.
|
4509
|
+
*
|
4510
|
+
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'length',
|
4511
|
+
* function (_super) {
|
4512
|
+
* }
|
4513
|
+
* , function (_super) {
|
4514
|
+
* }
|
4515
|
+
* );
|
4516
|
+
*
|
4517
|
+
* Can also be accessed directly from `chai.Assertion`.
|
4518
|
+
*
|
4519
|
+
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
4520
|
+
*
|
4521
|
+
* Then can be used as any other assertion.
|
4522
|
+
*
|
4523
|
+
* expect(myFoo).to.have.length(3);
|
4524
|
+
* expect(myFoo).to.have.length.above(3);
|
4525
|
+
*
|
4526
|
+
* @param {Object} ctx object whose method / property is to be overwritten
|
4527
|
+
* @param {String} name of method / property to overwrite
|
4528
|
+
* @param {Function} method function that returns a function to be used for name
|
4529
|
+
* @param {Function} chainingBehavior function that returns a function to be used for property
|
4530
|
+
* @name overwriteChainableMethod
|
4531
|
+
* @api public
|
4532
|
+
*/
|
4533
|
+
|
4534
|
+
module.exports = function (ctx, name, method, chainingBehavior) {
|
4535
|
+
var chainableBehavior = ctx.__methods[name];
|
4536
|
+
|
4537
|
+
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
4538
|
+
chainableBehavior.chainingBehavior = function () {
|
4539
|
+
var result = chainingBehavior(_chainingBehavior).call(this);
|
4540
|
+
return result === undefined ? this : result;
|
4541
|
+
};
|
4542
|
+
|
4543
|
+
var _method = chainableBehavior.method;
|
4544
|
+
chainableBehavior.method = function () {
|
4545
|
+
var result = method(_method).apply(this, arguments);
|
4546
|
+
return result === undefined ? this : result;
|
4547
|
+
};
|
4548
|
+
};
|
4549
|
+
|
4118
4550
|
});
|
4119
4551
|
require.register("chai/lib/chai/utils/test.js", function(exports, require, module){
|
4120
4552
|
/*!
|
4121
4553
|
* Chai - test utility
|
4122
|
-
* Copyright(c) 2012-
|
4554
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4123
4555
|
* MIT Licensed
|
4124
4556
|
*/
|
4125
4557
|
|
@@ -4148,7 +4580,7 @@ module.exports = function (obj, args) {
|
|
4148
4580
|
require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){
|
4149
4581
|
/*!
|
4150
4582
|
* Chai - transferFlags utility
|
4151
|
-
* Copyright(c) 2012-
|
4583
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4152
4584
|
* MIT Licensed
|
4153
4585
|
*/
|
4154
4586
|
|
@@ -4195,7 +4627,7 @@ module.exports = function (assertion, object, includeAll) {
|
|
4195
4627
|
require.register("chai/lib/chai/utils/type.js", function(exports, require, module){
|
4196
4628
|
/*!
|
4197
4629
|
* Chai - type utility
|
4198
|
-
* Copyright(c) 2012-
|
4630
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4199
4631
|
* MIT Licensed
|
4200
4632
|
*/
|
4201
4633
|
|
@@ -4240,12 +4672,25 @@ module.exports = function (obj) {
|
|
4240
4672
|
};
|
4241
4673
|
|
4242
4674
|
});
|
4243
|
-
require.alias("chai/index.js", "chai/index.js");
|
4244
4675
|
|
4245
|
-
|
4676
|
+
|
4677
|
+
|
4678
|
+
|
4679
|
+
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4680
|
+
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4681
|
+
require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js");
|
4682
|
+
require.alias("chaijs-assertion-error/index.js", "chaijs-assertion-error/index.js");
|
4683
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/lib/eql.js");
|
4684
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chai/deps/deep-eql/index.js");
|
4685
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "deep-eql/index.js");
|
4686
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/lib/type.js");
|
4687
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-deep-eql/deps/type-detect/index.js");
|
4688
|
+
require.alias("chaijs-type-detect/lib/type.js", "chaijs-type-detect/index.js");
|
4689
|
+
require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js");
|
4690
|
+
require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") {
|
4246
4691
|
module.exports = require("chai");
|
4247
4692
|
} else if (typeof define == "function" && define.amd) {
|
4248
|
-
define(function(){ return require("chai"); });
|
4693
|
+
define([], function(){ return require("chai"); });
|
4249
4694
|
} else {
|
4250
4695
|
this["chai"] = require("chai");
|
4251
4696
|
}})();
|