jasmine-core 2.9.0 → 2.99.2

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/jasmine-html.js +24 -1
  3. data/lib/jasmine-core/jasmine.css +1 -0
  4. data/lib/jasmine-core/jasmine.js +50 -6
  5. data/lib/jasmine-core/version.rb +1 -1
  6. metadata +3 -84
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  9. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  10. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
  11. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
  12. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  13. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
  14. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
  15. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  16. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  17. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  18. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  19. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  20. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
  21. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
  22. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
  23. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
  24. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
  25. data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
  26. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
  27. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
  28. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  29. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
  30. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  38. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  39. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
  40. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
  41. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
  42. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  43. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  44. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  45. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
  46. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  47. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  48. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  49. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  50. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  51. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  52. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  53. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  54. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  55. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  56. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  57. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  58. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  59. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  60. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  61. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  62. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
  63. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  64. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  65. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  67. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  68. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  69. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  70. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
  71. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  72. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  73. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  74. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  75. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  76. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
  77. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
  78. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
  79. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  80. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  81. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
  82. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  83. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  84. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
  85. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  86. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  87. data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,54 +0,0 @@
1
- describe("UserContext", function() {
2
- it("Behaves just like an plain object", function() {
3
- var context = new jasmineUnderTest.UserContext(),
4
- properties = [];
5
-
6
- for (var prop in context) {
7
- if (obj.hasOwnProperty(prop)) {
8
- properties.push(prop);
9
- }
10
- }
11
-
12
- expect(properties).toEqual([]);
13
- });
14
-
15
- describe('.fromExisting', function() {
16
- describe('when using an already built context as model', function() {
17
- beforeEach(function() {
18
- this.context = new jasmineUnderTest.UserContext();
19
- this.context.key = 'value';
20
- this.cloned = jasmineUnderTest.UserContext.fromExisting(this.context);
21
- });
22
-
23
- it('returns a cloned object', function() {
24
- expect(this.cloned).toEqual(this.context);
25
- });
26
-
27
- it('does not return the same object', function() {
28
- expect(this.cloned).not.toBe(this.context);
29
- });
30
- });
31
-
32
- describe('when using a regular object as parameter', function() {
33
- beforeEach(function() {
34
- this.context = {};
35
- this.value = 'value'
36
- this.context.key = this.value;
37
- this.cloned = jasmineUnderTest.UserContext.fromExisting(this.context);
38
- });
39
-
40
- it('returns an object with the same attributes', function() {
41
- expect(this.cloned.key).toEqual(this.value);
42
- });
43
-
44
- it('does not return the same object', function() {
45
- expect(this.cloned).not.toBe(this.context);
46
- });
47
-
48
- it('returns an UserContext', function() {
49
- expect(this.cloned.constructor).toBe(jasmineUnderTest.UserContext);
50
- });
51
- });
52
- });
53
- });
54
-
@@ -1,99 +0,0 @@
1
- describe("jasmineUnderTest.util", function() {
2
- describe("isArray_", function() {
3
- it("should return true if the argument is an array", function() {
4
- expect(jasmineUnderTest.isArray_([])).toBe(true);
5
- expect(jasmineUnderTest.isArray_(['a'])).toBe(true);
6
- });
7
-
8
- it("should return false if the argument is not an array", function() {
9
- expect(jasmineUnderTest.isArray_(undefined)).toBe(false);
10
- expect(jasmineUnderTest.isArray_({})).toBe(false);
11
- expect(jasmineUnderTest.isArray_(function() {})).toBe(false);
12
- expect(jasmineUnderTest.isArray_('foo')).toBe(false);
13
- expect(jasmineUnderTest.isArray_(5)).toBe(false);
14
- expect(jasmineUnderTest.isArray_(null)).toBe(false);
15
- });
16
- });
17
-
18
- describe("isObject_", function() {
19
- it("should return true if the argument is an object", function() {
20
- expect(jasmineUnderTest.isObject_({})).toBe(true);
21
- expect(jasmineUnderTest.isObject_({an: "object"})).toBe(true);
22
- });
23
-
24
- it("should return false if the argument is not an object", function() {
25
- expect(jasmineUnderTest.isObject_(undefined)).toBe(false);
26
- expect(jasmineUnderTest.isObject_([])).toBe(false);
27
- expect(jasmineUnderTest.isObject_(function() {})).toBe(false);
28
- expect(jasmineUnderTest.isObject_('foo')).toBe(false);
29
- expect(jasmineUnderTest.isObject_(5)).toBe(false);
30
- expect(jasmineUnderTest.isObject_(null)).toBe(false);
31
- });
32
- });
33
-
34
- describe("isUndefined", function() {
35
- it("reports if a variable is defined", function() {
36
- var a;
37
- expect(jasmineUnderTest.util.isUndefined(a)).toBe(true);
38
- expect(jasmineUnderTest.util.isUndefined(undefined)).toBe(true);
39
-
40
- var undefined = "diz be undefined yo";
41
- expect(jasmineUnderTest.util.isUndefined(undefined)).toBe(false);
42
- });
43
- });
44
-
45
- describe("getPropertyDescriptor", function() {
46
- // IE 8 doesn't support `definePropery` on non-DOM nodes
47
- if (jasmine.getEnv().ieVersion < 9) { return; }
48
-
49
- it("get property descriptor from object", function() {
50
- var obj = {prop: 1},
51
- actual = jasmineUnderTest.util.getPropertyDescriptor(obj, 'prop'),
52
- expected = Object.getOwnPropertyDescriptor(obj, 'prop');
53
-
54
- expect(actual).toEqual(expected);
55
- });
56
-
57
- it("get property descriptor from object property", function() {
58
- var proto = {prop: 1},
59
- obj = Object.create(proto),
60
- actual = jasmineUnderTest.util.getPropertyDescriptor(proto, 'prop'),
61
- expected = Object.getOwnPropertyDescriptor(proto, 'prop');
62
-
63
- expect(actual).toEqual(expected);
64
- });
65
- });
66
-
67
- describe("objectDifference", function() {
68
- it("given two objects A and B, returns the properties in A not present in B", function() {
69
- var a = {
70
- foo: 3,
71
- bar: 4,
72
- baz: 5
73
- };
74
-
75
- var b = {
76
- bar: 6,
77
- quux: 7
78
- };
79
-
80
- expect(jasmineUnderTest.util.objectDifference(a, b)).toEqual({foo: 3, baz: 5})
81
- });
82
-
83
- it("only looks at own properties of both objects", function() {
84
- function Foo() {}
85
-
86
- Foo.prototype.x = 1;
87
- Foo.prototype.y = 2;
88
-
89
- var a = new Foo();
90
- a.x = 1;
91
-
92
- var b = new Foo();
93
- b.y = 2;
94
-
95
- expect(jasmineUnderTest.util.objectDifference(a, b)).toEqual({x: 1});
96
- expect(jasmineUnderTest.util.objectDifference(b, a)).toEqual({y: 2});
97
- })
98
- })
99
- });
@@ -1,84 +0,0 @@
1
- describe("Any", function() {
2
- it("matches a string", function() {
3
- var any = new jasmineUnderTest.Any(String);
4
-
5
- expect(any.asymmetricMatch("foo")).toBe(true);
6
- });
7
-
8
- it("matches a number", function() {
9
- var any = new jasmineUnderTest.Any(Number);
10
-
11
- expect(any.asymmetricMatch(1)).toBe(true);
12
- });
13
-
14
- it("matches a function", function() {
15
- var any = new jasmineUnderTest.Any(Function);
16
-
17
- expect(any.asymmetricMatch(function(){})).toBe(true);
18
- });
19
-
20
- it("matches an Object", function() {
21
- var any = new jasmineUnderTest.Any(Object);
22
-
23
- expect(any.asymmetricMatch({})).toBe(true);
24
- });
25
-
26
- it("matches a Boolean", function() {
27
- var any = new jasmineUnderTest.Any(Boolean);
28
-
29
- expect(any.asymmetricMatch(true)).toBe(true);
30
- });
31
-
32
- it("matches a Map", function() {
33
- jasmine.getEnv().requireFunctioningMaps();
34
-
35
- var any = new jasmineUnderTest.Any(Map);
36
-
37
- expect(any.asymmetricMatch(new Map())).toBe(true);
38
- });
39
-
40
- it("matches a Set", function() {
41
- jasmine.getEnv().requireFunctioningSets();
42
-
43
- var any = new jasmineUnderTest.Any(Set);
44
-
45
- expect(any.asymmetricMatch(new Set())).toBe(true);
46
- });
47
-
48
- it("matches a TypedArray", function() {
49
- jasmine.getEnv().requireFunctioningTypedArrays();
50
-
51
- var any = new jasmineUnderTest.Any(Uint32Array);
52
-
53
- expect(any.asymmetricMatch(new Uint32Array([]))).toBe(true);
54
- });
55
-
56
- it("matches a Symbol", function() {
57
- jasmine.getEnv().requireFunctioningSymbols();
58
-
59
- var any = new jasmineUnderTest.Any(Symbol);
60
-
61
- expect(any.asymmetricMatch(Symbol())).toBe(true);
62
- });
63
-
64
- it("matches another constructed object", function() {
65
- var Thing = function() {},
66
- any = new jasmineUnderTest.Any(Thing);
67
-
68
- expect(any.asymmetricMatch(new Thing())).toBe(true);
69
- });
70
-
71
- it("jasmineToString's itself", function() {
72
- var any = new jasmineUnderTest.Any(Number);
73
-
74
- expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
75
- });
76
-
77
- describe("when called without an argument", function() {
78
- it("tells the user to pass a constructor or use jasmine.anything()", function() {
79
- expect(function() {
80
- new jasmineUnderTest.Any();
81
- }).toThrowError(TypeError, /constructor.*anything/);
82
- });
83
- });
84
- });
@@ -1,76 +0,0 @@
1
- describe("Anything", function() {
2
- it("matches a string", function() {
3
- var anything = new jasmineUnderTest.Anything();
4
-
5
- expect(anything.asymmetricMatch('foo')).toBe(true);
6
- });
7
-
8
- it("matches a number", function() {
9
- var anything = new jasmineUnderTest.Anything();
10
-
11
- expect(anything.asymmetricMatch(42)).toBe(true);
12
- });
13
-
14
- it("matches an object", function() {
15
- var anything = new jasmineUnderTest.Anything();
16
-
17
- expect(anything.asymmetricMatch({ foo: 'bar' })).toBe(true);
18
- });
19
-
20
- it("matches an array", function() {
21
- var anything = new jasmineUnderTest.Anything();
22
-
23
- expect(anything.asymmetricMatch([1,2,3])).toBe(true);
24
- });
25
-
26
- it("matches a Map", function() {
27
- jasmine.getEnv().requireFunctioningMaps();
28
-
29
- var anything = new jasmineUnderTest.Anything();
30
-
31
- expect(anything.asymmetricMatch(new Map())).toBe(true);
32
- });
33
-
34
- it("matches a Set", function() {
35
- jasmine.getEnv().requireFunctioningSets();
36
-
37
- var anything = new jasmineUnderTest.Anything();
38
-
39
- expect(anything.asymmetricMatch(new Set())).toBe(true);
40
- });
41
-
42
- it("matches a TypedArray", function() {
43
- jasmine.getEnv().requireFunctioningTypedArrays();
44
-
45
- var anything = new jasmineUnderTest.Anything();
46
-
47
- expect(anything.asymmetricMatch(new Uint32Array([]))).toBe(true);
48
- });
49
-
50
- it("matches a Symbol", function() {
51
- jasmine.getEnv().requireFunctioningSymbols();
52
-
53
- var anything = new jasmineUnderTest.Anything();
54
-
55
- expect(anything.asymmetricMatch(Symbol())).toBe(true);
56
- });
57
-
58
- it("doesn't match undefined", function() {
59
- var anything = new jasmineUnderTest.Anything();
60
-
61
- expect(anything.asymmetricMatch()).toBe(false);
62
- expect(anything.asymmetricMatch(undefined)).toBe(false);
63
- });
64
-
65
- it("doesn't match null", function() {
66
- var anything = new jasmineUnderTest.Anything();
67
-
68
- expect(anything.asymmetricMatch(null)).toBe(false);
69
- });
70
-
71
- it("jasmineToString's itself", function() {
72
- var anything = new jasmineUnderTest.Anything();
73
-
74
- expect(anything.jasmineToString()).toEqual("<jasmine.anything>");
75
- });
76
- });
@@ -1,52 +0,0 @@
1
- describe("ArrayContaining", function() {
2
- it("matches any actual to an empty array", function() {
3
- var containing = new jasmineUnderTest.ArrayContaining([]);
4
-
5
- expect(containing.asymmetricMatch("foo")).toBe(true);
6
- });
7
-
8
- it("does not work when not passed an array", function() {
9
- var containing = new jasmineUnderTest.ArrayContaining("foo");
10
-
11
- expect(function() {
12
- containing.asymmetricMatch([]);
13
- }).toThrowError(/not 'foo'/);
14
- });
15
-
16
- it("matches when the item is in the actual", function() {
17
- var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
18
-
19
- expect(containing.asymmetricMatch(["foo"])).toBe(true);
20
- });
21
-
22
- it("matches when additional items are in the actual", function() {
23
- var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
24
-
25
- expect(containing.asymmetricMatch(["foo", "bar"])).toBe(true);
26
- });
27
-
28
- it("does not match when the item is not in the actual", function() {
29
- var containing = new jasmineUnderTest.ArrayContaining(["foo"]);
30
-
31
- expect(containing.asymmetricMatch(["bar"])).toBe(false);
32
- });
33
-
34
- it("jasmineToStrings itself", function() {
35
- var containing = new jasmineUnderTest.ArrayContaining([]);
36
-
37
- expect(containing.jasmineToString()).toMatch("<jasmine.arrayContaining");
38
- });
39
-
40
- it("uses custom equality testers", function() {
41
- var tester = function(a, b) {
42
- // All "foo*" strings match each other.
43
- if (typeof a == "string" && typeof b == "string" &&
44
- a.substr(0, 3) == "foo" && b.substr(0, 3) == "foo") {
45
- return true;
46
- }
47
- };
48
- var containing = new jasmineUnderTest.ArrayContaining(["fooVal"]);
49
-
50
- expect(containing.asymmetricMatch(["fooBar"], [tester])).toBe(true);
51
- });
52
- });
@@ -1,47 +0,0 @@
1
- describe("ArrayWithExactContents", function() {
2
- it("matches an array with the same items in a different order", function() {
3
- var matcher = new jasmineUnderTest.ArrayWithExactContents(['a', 2, /a/]);
4
-
5
- expect(matcher.asymmetricMatch([2, 'a', /a/])).toBe(true);
6
- });
7
-
8
- it("does not work when not passed an array", function() {
9
- var matcher = new jasmineUnderTest.ArrayWithExactContents("foo");
10
-
11
- expect(function() {
12
- matcher.asymmetricMatch([]);
13
- }).toThrowError(/not 'foo'/);
14
- });
15
-
16
- it("does not match when an item is missing", function() {
17
- var matcher = new jasmineUnderTest.ArrayWithExactContents(['a', 2, /a/]);
18
-
19
- expect(matcher.asymmetricMatch(['a', 2])).toBe(false);
20
- expect(matcher.asymmetricMatch(['a', 2, undefined])).toBe(false);
21
- });
22
-
23
- it("does not match when there is an extra item", function() {
24
- var matcher = new jasmineUnderTest.ArrayWithExactContents(['a']);
25
-
26
- expect(matcher.asymmetricMatch(['a', 2])).toBe(false);
27
- });
28
-
29
- it("jasmineToStrings itself", function() {
30
- var matcher = new jasmineUnderTest.ArrayWithExactContents([]);
31
-
32
- expect(matcher.jasmineToString()).toMatch("<jasmine.arrayWithExactContents");
33
- });
34
-
35
- it("uses custom equality testers", function() {
36
- var tester = function(a, b) {
37
- // All "foo*" strings match each other.
38
- if (typeof a == "string" && typeof b == "string" &&
39
- a.substr(0, 3) == "foo" && b.substr(0, 3) == "foo") {
40
- return true;
41
- }
42
- };
43
- var matcher = new jasmineUnderTest.ArrayWithExactContents(["fooVal"]);
44
-
45
- expect(matcher.asymmetricMatch(["fooBar"], [tester])).toBe(true);
46
- });
47
- });
@@ -1,102 +0,0 @@
1
- describe("ObjectContaining", function() {
2
-
3
- it("matches any actual to an empty object", function() {
4
- var containing = new jasmineUnderTest.ObjectContaining({});
5
-
6
- expect(containing.asymmetricMatch("foo")).toBe(true);
7
- });
8
-
9
- it("does not match an empty object actual", function() {
10
- var containing = new jasmineUnderTest.ObjectContaining("foo");
11
-
12
- expect(function() {
13
- containing.asymmetricMatch({})
14
- }).toThrowError(/not 'foo'/)
15
- });
16
-
17
- it("matches when the key/value pair is present in the actual", function() {
18
- var containing = new jasmineUnderTest.ObjectContaining({foo: "fooVal"});
19
-
20
- expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(true);
21
- });
22
-
23
- it("does not match when the key/value pair is not present in the actual", function() {
24
- var containing = new jasmineUnderTest.ObjectContaining({foo: "fooVal"});
25
-
26
- expect(containing.asymmetricMatch({bar: "barVal", quux: "quuxVal"})).toBe(false);
27
- });
28
-
29
- it("does not match when the key is present but the value is different in the actual", function() {
30
- var containing = new jasmineUnderTest.ObjectContaining({foo: "other"});
31
-
32
- expect(containing.asymmetricMatch({foo: "fooVal", bar: "barVal"})).toBe(false);
33
- });
34
-
35
- it("jasmineToString's itself", function() {
36
- var containing = new jasmineUnderTest.ObjectContaining({});
37
-
38
- expect(containing.jasmineToString()).toMatch("<jasmine.objectContaining");
39
- });
40
-
41
- it("matches recursively", function() {
42
- var containing = new jasmineUnderTest.ObjectContaining({one: new jasmineUnderTest.ObjectContaining({two: {}})});
43
-
44
- expect(containing.asymmetricMatch({one: {two: {}}})).toBe(true);
45
- });
46
-
47
- it("matches when key is present with undefined value", function() {
48
- var containing = new jasmineUnderTest.ObjectContaining({ one: undefined });
49
-
50
- expect(containing.asymmetricMatch({ one: undefined })).toBe(true);
51
- });
52
-
53
- it("does not match when key with undefined value is not present", function() {
54
- var containing = new jasmineUnderTest.ObjectContaining({ one: undefined });
55
-
56
- expect(containing.asymmetricMatch({})).toBe(false);
57
- });
58
-
59
- it("matches defined properties", function(){
60
- // IE 8 doesn't support `definePropery` on non-DOM nodes
61
- if (jasmine.getEnv().ieVersion < 9) { return; }
62
-
63
- var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" });
64
-
65
- var definedPropertyObject = {};
66
- Object.defineProperty(definedPropertyObject, "foo", {
67
- get: function() { return "fooVal" }
68
- });
69
- expect(containing.asymmetricMatch(definedPropertyObject)).toBe(true);
70
- });
71
-
72
- it("matches prototype properties", function(){
73
- var containing = new jasmineUnderTest.ObjectContaining({ foo: "fooVal" });
74
-
75
- var prototypeObject = {foo: "fooVal"};
76
- var obj;
77
-
78
- if (Object.create) {
79
- obj = Object.create(prototypeObject);
80
- } else {
81
- function Foo() {}
82
- Foo.prototype = prototypeObject;
83
- Foo.prototype.constructor = Foo;
84
- obj = new Foo();
85
- }
86
-
87
- expect(containing.asymmetricMatch(obj)).toBe(true);
88
- });
89
-
90
- it("uses custom equality testers", function() {
91
- var tester = function(a, b) {
92
- // All "foo*" strings match each other.
93
- if (typeof a == "string" && typeof b == "string" &&
94
- a.substr(0, 3) == "foo" && b.substr(0, 3) == "foo") {
95
- return true;
96
- }
97
- };
98
- var containing = new jasmineUnderTest.ObjectContaining({foo: "fooVal"});
99
-
100
- expect(containing.asymmetricMatch({foo: "fooBar"}, [tester])).toBe(true);
101
- });
102
- });
@@ -1,27 +0,0 @@
1
- describe("StringMatching", function() {
2
- it("matches a string against a provided regexp", function() {
3
- var matcher = new jasmineUnderTest.StringMatching(/foo/);
4
-
5
- expect(matcher.asymmetricMatch('barfoobaz')).toBe(true);
6
- expect(matcher.asymmetricMatch('barbaz')).toBe(false);
7
- });
8
-
9
- it("matches a string against provided string", function() {
10
- var matcher = new jasmineUnderTest.StringMatching('foo');
11
-
12
- expect(matcher.asymmetricMatch('barfoobaz')).toBe(true);
13
- expect(matcher.asymmetricMatch('barbaz')).toBe(false);
14
- });
15
-
16
- it("raises an Error when the expected is not a String or RegExp", function() {
17
- expect(function() {
18
- new jasmineUnderTest.StringMatching({});
19
- }).toThrowError(/not a String or a RegExp/);
20
- });
21
-
22
- it("jasmineToString's itself", function() {
23
- var matching = new jasmineUnderTest.StringMatching(/^foo/);
24
-
25
- expect(matching.jasmineToString()).toEqual("<jasmine.stringMatching(/^foo/)>");
26
- });
27
- });
@@ -1,13 +0,0 @@
1
- describe('formatErrorMsg', function () {
2
- it('should format an error with a domain', function() {
3
- var formator = jasmineUnderTest.formatErrorMsg('api');
4
- expect(formator('message')).toBe('api : message');
5
- expect(formator('message2')).toBe('api : message2');
6
- });
7
-
8
- it('should format an error with a domain and usage', function() {
9
- var formator = jasmineUnderTest.formatErrorMsg('api', 'with a param');
10
- expect(formator('message')).toBe('api : message\nUsage: with a param');
11
- expect(formator('message2')).toBe('api : message2\nUsage: with a param');
12
- });
13
- });