jasmine-core 2.99.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/boot.js +7 -6
  3. data/lib/jasmine-core/boot/boot.js +7 -6
  4. data/lib/jasmine-core/boot/node_boot.js +0 -3
  5. data/lib/jasmine-core/jasmine-html.js +228 -137
  6. data/lib/jasmine-core/jasmine.css +11 -5
  7. data/lib/jasmine-core/jasmine.js +1046 -608
  8. data/lib/jasmine-core/node_boot.js +0 -3
  9. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +130 -0
  10. data/lib/jasmine-core/spec/core/ClearStackSpec.js +137 -0
  11. data/lib/jasmine-core/spec/core/ClockSpec.js +710 -0
  12. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +286 -0
  13. data/lib/jasmine-core/spec/core/EnvSpec.js +200 -0
  14. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +120 -0
  15. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +46 -0
  16. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
  17. data/lib/jasmine-core/spec/core/ExpectationSpec.js +434 -0
  18. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +110 -0
  19. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +259 -0
  20. data/lib/jasmine-core/spec/core/MockDateSpec.js +200 -0
  21. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +332 -0
  22. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +670 -0
  23. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +140 -0
  24. data/lib/jasmine-core/spec/core/SpecSpec.js +407 -0
  25. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +364 -0
  26. data/lib/jasmine-core/spec/core/SpySpec.js +177 -0
  27. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +202 -0
  28. data/lib/jasmine-core/spec/core/StackTraceSpec.js +166 -0
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +123 -0
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +31 -0
  31. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +794 -0
  32. data/lib/jasmine-core/spec/core/UserContextSpec.js +54 -0
  33. data/lib/jasmine-core/spec/core/UtilSpec.js +105 -0
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +91 -0
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +76 -0
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +52 -0
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +47 -0
  38. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +99 -0
  39. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +27 -0
  40. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
  41. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +200 -0
  42. data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +138 -0
  43. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +2344 -0
  44. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +976 -0
  45. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +47 -0
  46. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +13 -0
  47. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +43 -0
  48. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +645 -0
  49. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +8 -0
  50. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +93 -0
  51. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
  52. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
  53. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
  54. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +20 -0
  55. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
  56. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
  57. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +37 -0
  58. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +31 -0
  59. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
  60. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +31 -0
  61. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
  62. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
  63. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +18 -0
  64. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +26 -0
  65. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +785 -0
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +99 -0
  67. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +47 -0
  68. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +86 -0
  69. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +67 -0
  70. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +43 -0
  71. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +315 -0
  72. data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +73 -0
  73. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +100 -0
  74. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +15 -0
  75. data/lib/jasmine-core/spec/helpers/asyncAwait.js +27 -0
  76. data/lib/jasmine-core/spec/helpers/checkForMap.js +37 -0
  77. data/lib/jasmine-core/spec/helpers/checkForSet.js +41 -0
  78. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +28 -0
  79. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +20 -0
  80. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +6 -0
  81. data/lib/jasmine-core/spec/helpers/integrationMatchers.js +43 -0
  82. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +30 -0
  83. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +1261 -0
  84. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
  85. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +37 -0
  86. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +27 -0
  87. data/lib/jasmine-core/spec/html/QueryStringSpec.js +72 -0
  88. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
  89. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +39 -0
  90. data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +48 -0
  91. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +101 -0
  92. data/lib/jasmine-core/spec/performance/large_object_test.js +36 -0
  93. data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
  94. data/lib/jasmine-core/version.rb +1 -1
  95. metadata +88 -4
  96. data/lib/console/console.js +0 -190
@@ -0,0 +1,18 @@
1
+ describe("jasmineUnderTest.HtmlSpecFilter", function() {
2
+
3
+ it("should match when no string is provided", function() {
4
+ var specFilter = new jasmineUnderTest.HtmlSpecFilter();
5
+
6
+ expect(specFilter.matches("foo")).toBe(true);
7
+ expect(specFilter.matches("*bar")).toBe(true);
8
+ });
9
+
10
+ it("should only match the provided string", function() {
11
+ var specFilter = new jasmineUnderTest.HtmlSpecFilter({
12
+ filterString: function() { return "foo"; }
13
+ });
14
+
15
+ expect(specFilter.matches("foo")).toBe(true);
16
+ expect(specFilter.matches("bar")).toBe(false);
17
+ });
18
+ });
@@ -0,0 +1,37 @@
1
+ describe("MatchersSpec - HTML Dependent", function () {
2
+ var env, spec;
3
+
4
+ beforeEach(function() {
5
+ env = new jasmineUnderTest.Env();
6
+
7
+ var suite = env.describe("suite", function() {
8
+ spec = env.it("spec", function() {
9
+ });
10
+ });
11
+ spyOn(spec, 'addExpectationResult');
12
+
13
+ addMatchers({
14
+ toPass: function() {
15
+ return lastResult().passed;
16
+ },
17
+ toFail: function() {
18
+ return !lastResult().passed;
19
+ }
20
+ });
21
+ });
22
+
23
+ function match(value) {
24
+ return spec.expect(value);
25
+ }
26
+
27
+ function lastResult() {
28
+ return spec.addExpectationResult.mostRecentCall.args[1];
29
+ }
30
+
31
+ xit("toEqual with DOM nodes", function() {
32
+ var nodeA = document.createElement('div');
33
+ var nodeB = document.createElement('div');
34
+ expect((match(nodeA).toEqual(nodeA))).toPass();
35
+ expect((match(nodeA).toEqual(nodeB))).toFail();
36
+ });
37
+ });
@@ -0,0 +1,27 @@
1
+ describe("jasmineUnderTest.pp (HTML Dependent)", function () {
2
+ it("should stringify non-element HTML nodes properly", function() {
3
+ var sampleNode = document.createTextNode("");
4
+ expect(jasmineUnderTest.pp(sampleNode)).toEqual("HTMLNode");
5
+ expect(jasmineUnderTest.pp({foo: sampleNode})).toEqual("Object({ foo: HTMLNode })");
6
+ });
7
+
8
+ it("should stringify empty HTML elements as their opening tags", function () {
9
+ var simple = document.createElement('div');
10
+ simple.className = 'foo';
11
+ expect(jasmineUnderTest.pp(simple)).toEqual('<div class="foo">');
12
+ });
13
+
14
+ it("should stringify non-empty HTML elements as tags with placeholders", function() {
15
+ var nonEmpty = document.createElement('div');
16
+ nonEmpty.className = 'foo';
17
+ nonEmpty.innerHTML = '<p>Irrelevant</p>';
18
+ expect(jasmineUnderTest.pp(nonEmpty)).toEqual('<div class="foo">...</div>');
19
+ });
20
+
21
+ it("should print Firefox's wrapped native objects correctly", function() {
22
+ if(jasmine.getEnv().firefoxVersion) {
23
+ try { new CustomEvent(); } catch(e) { var err = e; };
24
+ expect(jasmineUnderTest.pp(err)).toMatch(/Not enough arguments/);
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,72 @@
1
+ describe("QueryString", function() {
2
+
3
+ describe("#navigateWithNewParam", function() {
4
+ it("sets the query string to include the given key/value pair", function() {
5
+ var windowLocation = {
6
+ search: ""
7
+ },
8
+ queryString = new jasmineUnderTest.QueryString({
9
+ getWindowLocation: function() { return windowLocation }
10
+ });
11
+
12
+ queryString.navigateWithNewParam("foo", "bar baz");
13
+
14
+ expect(windowLocation.search).toMatch(/foo=bar%20baz/);
15
+ });
16
+
17
+ it("leaves existing params alone", function() {
18
+ var windowLocation = {
19
+ search: "?foo=bar"
20
+ },
21
+ queryString = new jasmineUnderTest.QueryString({
22
+ getWindowLocation: function() { return windowLocation }
23
+ });
24
+
25
+ queryString.navigateWithNewParam("baz", "quux");
26
+
27
+ expect(windowLocation.search).toMatch(/foo=bar/);
28
+ expect(windowLocation.search).toMatch(/baz=quux/);
29
+ });
30
+ });
31
+
32
+ describe('#fullStringWithNewParam', function() {
33
+ it("gets the query string including the given key/value pair", function() {
34
+ var windowLocation = {
35
+ search: "?foo=bar"
36
+ },
37
+ queryString = new jasmineUnderTest.QueryString({
38
+ getWindowLocation: function() { return windowLocation }
39
+ });
40
+
41
+ var result = queryString.fullStringWithNewParam("baz", "quux");
42
+
43
+ expect(result).toMatch(/foo=bar/);
44
+ expect(result).toMatch(/baz=quux/);
45
+ });
46
+ });
47
+
48
+ describe("#getParam", function() {
49
+
50
+ it("returns the value of the requested key", function() {
51
+ var windowLocation = {
52
+ search: "?baz=quux%20corge"
53
+ },
54
+ queryString = new jasmineUnderTest.QueryString({
55
+ getWindowLocation: function() { return windowLocation }
56
+ });
57
+
58
+ expect(queryString.getParam("baz")).toEqual("quux corge");
59
+ });
60
+
61
+ it("returns null if the key is not present", function() {
62
+ var windowLocation = {
63
+ search: ""
64
+ },
65
+ queryString = new jasmineUnderTest.QueryString({
66
+ getWindowLocation: function() { return windowLocation }
67
+ });
68
+
69
+ expect(queryString.getParam("baz")).toBeFalsy();
70
+ });
71
+ });
72
+ });
@@ -0,0 +1,62 @@
1
+ describe("ResultsNode", function() {
2
+ it("wraps a result", function() {
3
+ var fakeResult = {
4
+ id: 123,
5
+ message: "foo"
6
+ },
7
+ node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
8
+
9
+ expect(node.result).toBe(fakeResult);
10
+ expect(node.type).toEqual("suite");
11
+ });
12
+
13
+ it("can add children with a type", function() {
14
+ var fakeResult = {
15
+ id: 123,
16
+ message: "foo"
17
+ },
18
+ fakeChildResult = {
19
+ id: 456,
20
+ message: "bar"
21
+ },
22
+ node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
23
+
24
+ node.addChild(fakeChildResult, "spec");
25
+
26
+ expect(node.children.length).toEqual(1);
27
+ expect(node.children[0].result).toEqual(fakeChildResult);
28
+ expect(node.children[0].type).toEqual("spec");
29
+ });
30
+
31
+ it("has a pointer back to its parent ResultNode", function() {
32
+ var fakeResult = {
33
+ id: 123,
34
+ message: "foo"
35
+ },
36
+ fakeChildResult = {
37
+ id: 456,
38
+ message: "bar"
39
+ },
40
+ node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
41
+
42
+ node.addChild(fakeChildResult, "spec");
43
+
44
+ expect(node.children[0].parent).toBe(node);
45
+ });
46
+
47
+ it("can provide the most recent child", function() {
48
+ var fakeResult = {
49
+ id: 123,
50
+ message: "foo"
51
+ },
52
+ fakeChildResult = {
53
+ id: 456,
54
+ message: "bar"
55
+ },
56
+ node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
57
+
58
+ node.addChild(fakeChildResult, "spec");
59
+
60
+ expect(node.last()).toBe(node.children[node.children.length - 1]);
61
+ });
62
+ });
@@ -0,0 +1,39 @@
1
+ describe('Spy Registry browser-specific behavior', function() {
2
+ function createSpy(name, originalFn) {
3
+ return jasmineUnderTest.Spy(name, originalFn);
4
+ }
5
+
6
+ it('can spy on and unspy window.onerror', function() {
7
+ requireWriteableOnerror();
8
+
9
+ var spies = [],
10
+ spyRegistry = new jasmineUnderTest.SpyRegistry({
11
+ currentSpies: function() { return spies; },
12
+ createSpy: createSpy,
13
+ global: window
14
+ }),
15
+ originalHandler = window.onerror;
16
+
17
+ try {
18
+ spyRegistry.spyOn(window, 'onerror');
19
+ spyRegistry.clearSpies();
20
+ expect(window.onerror).toBe(originalHandler);
21
+ } finally {
22
+ window.onerror = originalHandler;
23
+ }
24
+ });
25
+
26
+ function requireWriteableOnerror() {
27
+ var descriptor;
28
+
29
+ try {
30
+ descriptor = Object.getOwnPropertyDescriptor(window, 'onerror');
31
+ } catch(e) {
32
+ // IE 8 doesn't support `definePropery` on non-DOM nodes
33
+ }
34
+
35
+ if (descriptor && !(descriptor.writable || descriptor.set)) {
36
+ pending('Browser declares window.onerror to be readonly');
37
+ }
38
+ }
39
+ });
@@ -0,0 +1,48 @@
1
+ describe('toHaveClass', function() {
2
+ it('fails for a DOM element that lacks the expected class', function() {
3
+ var matcher = jasmineUnderTest.matchers.toHaveClass(),
4
+ result = matcher.compare(document.createElement('div'), 'foo');
5
+
6
+ expect(result.pass).toBe(false);
7
+ });
8
+
9
+ it('passes for a DOM element that has the expected class', function() {
10
+ var matcher = jasmineUnderTest.matchers.toHaveClass(),
11
+ el = document.createElement('div');
12
+
13
+ el.className = 'foo bar baz';
14
+
15
+ expect(matcher.compare(el, 'foo').pass).toBe(true);
16
+ expect(matcher.compare(el, 'bar').pass).toBe(true);
17
+ expect(matcher.compare(el, 'bar').pass).toBe(true);
18
+ });
19
+
20
+ it('fails for a DOM element that only has other classes', function() {
21
+ var matcher = jasmineUnderTest.matchers.toHaveClass(),
22
+ el = document.createElement('div');
23
+
24
+ el.className = 'foo bar';
25
+
26
+ expect(matcher.compare(el, 'fo').pass).toBe(false);
27
+ });
28
+
29
+ it('throws an exception when actual is not a DOM element', function() {
30
+ var matcher = jasmineUnderTest.matchers.toHaveClass();
31
+
32
+ expect(function() {
33
+ matcher.compare('x', 'foo');
34
+ }).toThrowError("'x' is not a DOM element");
35
+
36
+ expect(function() {
37
+ matcher.compare(undefined, 'foo');
38
+ }).toThrowError('undefined is not a DOM element');
39
+
40
+ expect(function() {
41
+ matcher.compare(document.createTextNode(''), 'foo')
42
+ }).toThrowError('HTMLNode is not a DOM element');
43
+
44
+ expect(function() {
45
+ matcher.compare({classList: ''}, 'foo');
46
+ }).toThrowError("Object({ classList: '' }) is not a DOM element");
47
+ });
48
+ });
@@ -0,0 +1,101 @@
1
+ describe('npm package', function() {
2
+ var path = require('path'),
3
+ temp = require('temp').track(),
4
+ fs = require('fs');
5
+
6
+ beforeAll(function() {
7
+ var shell = require('shelljs'),
8
+ pack = shell.exec('npm pack', { silent: true});
9
+
10
+ this.tarball = pack.stdout.split('\n')[0];
11
+ this.tmpDir = temp.mkdirSync(); // automatically deleted on exit
12
+
13
+ var untar = shell.exec('tar -xzf ' + this.tarball + ' -C ' + this.tmpDir, { silent: true });
14
+ expect(untar.code).toBe(0);
15
+
16
+ this.packagedCore = require(path.join(this.tmpDir, 'package/lib/jasmine-core.js'));
17
+ });
18
+
19
+ beforeEach(function() {
20
+ jasmine.addMatchers({
21
+ toExistInPath: function(util, customEquality) {
22
+ return {
23
+ compare: function(actual, expected) {
24
+ var fullPath = path.resolve(expected, actual);
25
+ return {
26
+ pass: fs.existsSync(fullPath)
27
+ };
28
+ }
29
+ };
30
+ }
31
+ });
32
+ });
33
+
34
+ afterAll(function() {
35
+ var cleanup = function (parent, fileOrFolder) {
36
+ var fullPath = path.join(parent, fileOrFolder);
37
+ if (fs.statSync(fullPath).isFile()) {
38
+ fs.unlinkSync(fullPath);
39
+ } else {
40
+ fs.readdirSync(fullPath).forEach(cleanup.bind(null, fullPath));
41
+ fs.rmdirSync(fullPath);
42
+ }
43
+ };
44
+
45
+ fs.unlinkSync(this.tarball);
46
+ });
47
+
48
+ it('has a root path', function() {
49
+ expect(this.packagedCore.files.path).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/lib/jasmine-core')));
50
+ });
51
+
52
+ it('has a bootDir', function() {
53
+ expect(this.packagedCore.files.bootDir).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/lib/jasmine-core')));
54
+ });
55
+
56
+ it('has jsFiles', function() {
57
+ expect(this.packagedCore.files.jsFiles).toEqual([
58
+ 'jasmine.js',
59
+ 'jasmine-html.js',
60
+ 'json2.js'
61
+ ]);
62
+
63
+ var packagedCore = this.packagedCore;
64
+ this.packagedCore.files.jsFiles.forEach(function(fileName) {
65
+ expect(fileName).toExistInPath(packagedCore.files.path);
66
+ });
67
+ });
68
+
69
+ it('has cssFiles', function() {
70
+ expect(this.packagedCore.files.cssFiles).toEqual(['jasmine.css']);
71
+
72
+ var packagedCore = this.packagedCore;
73
+ this.packagedCore.files.cssFiles.forEach(function(fileName) {
74
+ expect(fileName).toExistInPath(packagedCore.files.path);
75
+ });
76
+ });
77
+
78
+ it('has bootFiles', function() {
79
+ expect(this.packagedCore.files.bootFiles).toEqual(['boot.js']);
80
+ expect(this.packagedCore.files.nodeBootFiles).toEqual(['node_boot.js']);
81
+
82
+ var packagedCore = this.packagedCore;
83
+ this.packagedCore.files.bootFiles.forEach(function(fileName) {
84
+ expect(fileName).toExistInPath(packagedCore.files.bootDir);
85
+ });
86
+
87
+ var packagedCore = this.packagedCore;
88
+ this.packagedCore.files.nodeBootFiles.forEach(function(fileName) {
89
+ expect(fileName).toExistInPath(packagedCore.files.bootDir);
90
+ });
91
+ });
92
+
93
+ it('has an imagesDir', function() {
94
+ expect(this.packagedCore.files.imagesDir).toEqual(fs.realpathSync(path.resolve(this.tmpDir, 'package/images')));
95
+ var images = fs.readdirSync(path.resolve(this.tmpDir, 'package/images'));
96
+
97
+ expect(images).toContain('jasmine-horizontal.png');
98
+ expect(images).toContain('jasmine-horizontal.svg');
99
+ expect(images).toContain('jasmine_favicon.png');
100
+ });
101
+ });
@@ -0,0 +1,36 @@
1
+ describe('Printing a big object', function(){
2
+ var bigObject;
3
+ function rand(upper) {
4
+ return Math.round(upper * Math.random());
5
+ }
6
+
7
+ function generateObject(level) {
8
+ var object = {};
9
+
10
+ for (var i = 0; i < 50; i++) {
11
+ var decide = rand(2);
12
+ switch (decide) {
13
+ case 0:
14
+ object["cycle" + i] = object;
15
+ break;
16
+ case 1:
17
+ object["number" + i] = rand(100);
18
+ break;
19
+ case 2:
20
+ if (level < 3) {
21
+ object["nesting" + i] = generateObject(level + 1);
22
+ }
23
+ break;
24
+ }
25
+
26
+ }
27
+
28
+ return object;
29
+ }
30
+
31
+ it('takes a resonable amount of time', function(){
32
+ bigObject = generateObject(0);
33
+ expect(jasmineUnderTest.pp(bigObject)).toMatch(/cycle/);
34
+ });
35
+ });
36
+