Skip to content

Commit b744130

Browse files
committed
Assert: made documentation more descriptive
Assert: made documentation more descriptive
1 parent 33e4403 commit b744130

File tree

1 file changed

+48
-40
lines changed

1 file changed

+48
-40
lines changed

lib/chai/interface/assert.js

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,9 +1013,11 @@ module.exports = function (chai, util) {
10131013
};
10141014

10151015
/**
1016-
* ### .nestedInclude(object1, object2, [message])
1016+
* ### .nestedInclude(haystack, needle, [message])
10171017
*
1018-
* Asserts that 'object1' includes 'object2'.
1018+
* Asserts that 'haystack' includes 'needle'.
1019+
* Can be used to assert the inclusion of a subset of properties in an
1020+
* object.
10191021
* Enables the use of dot- and bracket-notation for referencing nested
10201022
* properties.
10211023
* '[]' and '.' in property names can be escaped using double backslashes.
@@ -1024,8 +1026,8 @@ module.exports = function (chai, util) {
10241026
* assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
10251027
*
10261028
* @name nestedInclude
1027-
* @param {Object} object1
1028-
* @param {Object} object2
1029+
* @param {Object} haystack
1030+
* @param {Object} needle
10291031
* @param {String} message
10301032
* @namespace Assert
10311033
* @api public
@@ -1036,9 +1038,11 @@ module.exports = function (chai, util) {
10361038
};
10371039

10381040
/**
1039-
* ### .notNestedInclude(object1, object2, [message])
1041+
* ### .notNestedInclude(haystack, needle, [message])
10401042
*
1041-
* Asserts that 'object1' does not include 'object2'.
1043+
* Asserts that 'haystack' does not include 'needle'.
1044+
* Can be used to assert the absence of a subset of properties in an
1045+
* object.
10421046
* Enables the use of dot- and bracket-notation for referencing nested
10431047
* properties.
10441048
* '[]' and '.' in property names can be escaped using double backslashes.
@@ -1047,8 +1051,8 @@ module.exports = function (chai, util) {
10471051
* assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
10481052
*
10491053
* @name notNestedInclude
1050-
* @param {Object} object1
1051-
* @param {Object} object2
1054+
* @param {Object} haystack
1055+
* @param {Object} needle
10521056
* @param {String} message
10531057
* @namespace Assert
10541058
* @api public
@@ -1060,10 +1064,11 @@ module.exports = function (chai, util) {
10601064
};
10611065

10621066
/**
1063-
* ### .deepNestedInclude(object1, object2, [message])
1067+
* ### .deepNestedInclude(haystack, needle, [message])
10641068
*
1065-
* Asserts that 'object1' includes 'object2' while checking for
1066-
* deep equality.
1069+
* Asserts that 'haystack' includes 'needle'.
1070+
* Can be used to assert the inclusion of a subset of properties in an
1071+
* object while checking for deep equality.
10671072
* Enables the use of dot- and bracket-notation for referencing nested
10681073
* properties.
10691074
* '[]' and '.' in property names can be escaped using double backslashes.
@@ -1072,8 +1077,8 @@ module.exports = function (chai, util) {
10721077
* assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}});
10731078
*
10741079
* @name deepNestedInclude
1075-
* @param {Object} object1
1076-
* @param {Object} object2
1080+
* @param {Object} haystack
1081+
* @param {Object} needle
10771082
* @param {String} message
10781083
* @namespace Assert
10791084
* @api public
@@ -1085,10 +1090,11 @@ module.exports = function (chai, util) {
10851090
};
10861091

10871092
/**
1088-
* ### .notDeepNestedInclude(object1, object2, [message])
1093+
* ### .notDeepNestedInclude(haystack, needle, [message])
10891094
*
1090-
* Asserts that 'object1' does not include 'object2' while
1091-
* checking for deep equality.
1095+
* Asserts that 'haystack' does not include 'needle'.
1096+
* Can be used to assert the absence of a subset of properties in an
1097+
* object while checking for deep equality.
10921098
* Enables the use of dot- and bracket-notation for referencing nested
10931099
* properties.
10941100
* '[]' and '.' in property names can be escaped using double backslashes.
@@ -1097,8 +1103,8 @@ module.exports = function (chai, util) {
10971103
* assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
10981104
*
10991105
* @name notDeepNestedInclude
1100-
* @param {Object} object1
1101-
* @param {Object} object2
1106+
* @param {Object} haystack
1107+
* @param {Object} needle
11021108
* @param {String} message
11031109
* @namespace Assert
11041110
* @api public
@@ -1110,16 +1116,17 @@ module.exports = function (chai, util) {
11101116
};
11111117

11121118
/**
1113-
* ### .ownInclude(object1, object2, [message])
1119+
* ### .ownInclude(haystack, needle, [message])
11141120
*
1115-
* Asserts that 'object1' includes 'object2' while
1116-
* ignoring inherited properties.
1121+
* Asserts that 'haystack' includes 'needle'.
1122+
* Can be used to assert the inclusion of a subset of properties in an
1123+
* object while ignoring inherited properties.
11171124
*
11181125
* assert.ownInclude({ a: 1 }, { a: 1 });
11191126
*
11201127
* @name ownInclude
1121-
* @param {Object} object1
1122-
* @param {Object} object2
1128+
* @param {Object} haystack
1129+
* @param {Object} needle
11231130
* @param {String} message
11241131
* @namespace Assert
11251132
* @api public
@@ -1130,18 +1137,19 @@ module.exports = function (chai, util) {
11301137
};
11311138

11321139
/**
1133-
* ### .notOwnInclude(object1, object2, [message])
1140+
* ### .notOwnInclude(haystack, needle, [message])
11341141
*
1135-
* Asserts that 'object1' does not include 'object2' while
1136-
* ignoring inherited properties.
1142+
* Asserts that 'haystack' includes 'needle'.
1143+
* Can be used to assert the absence of a subset of properties in an
1144+
* object while ignoring inherited properties.
11371145
*
11381146
* Object.prototype.b = 2;
11391147
*
11401148
* assert.notOwnInclude({ a: 1 }, { b: 2 });
11411149
*
11421150
* @name notOwnInclude
1143-
* @param {Object} object1
1144-
* @param {Object} object2
1151+
* @param {Object} haystack
1152+
* @param {Object} needle
11451153
* @param {String} message
11461154
* @namespace Assert
11471155
* @api public
@@ -1152,17 +1160,17 @@ module.exports = function (chai, util) {
11521160
};
11531161

11541162
/**
1155-
* ### .deepOwnInclude(object1, object2, [message])
1163+
* ### .deepOwnInclude(haystack, needle, [message])
11561164
*
1157-
* Asserts that 'object1' includes 'object2' while
1158-
* ignoring inherited properties.
1159-
* Deep equality is used.
1165+
* Asserts that 'haystack' includes 'needle'.
1166+
* Can be used to assert the inclusion of a subset of properties in an
1167+
* object while ignoring inherited properties and checking for deep equality.
11601168
*
11611169
* assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
11621170
*
11631171
* @name deepOwnInclude
1164-
* @param {Object} object1
1165-
* @param {Object} object2
1172+
* @param {Object} haystack
1173+
* @param {Object} needle
11661174
* @param {String} message
11671175
* @namespace Assert
11681176
* @api public
@@ -1174,17 +1182,17 @@ module.exports = function (chai, util) {
11741182
};
11751183

11761184
/**
1177-
* ### .notDeepOwnInclude(object1, object2, [message])
1185+
* ### .notDeepOwnInclude(haystack, needle, [message])
11781186
*
1179-
* Asserts that 'object1' does not include 'object2' while
1180-
* ignoring inherited properties.
1181-
* Deep equality is used.
1187+
* Asserts that 'haystack' includes 'needle'.
1188+
* Can be used to assert the absence of a subset of properties in an
1189+
* object while ignoring inherited properties and checking for deep equality.
11821190
*
11831191
* assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
11841192
*
11851193
* @name notDeepOwnInclude
1186-
* @param {Object} object1
1187-
* @param {Object} object2
1194+
* @param {Object} haystack
1195+
* @param {Object} needle
11881196
* @param {String} message
11891197
* @namespace Assert
11901198
* @api public

0 commit comments

Comments
 (0)