@wordpress/jest-console 7.4.0 → 7.6.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.
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/build/matchers.js +2 -7
- package/build/matchers.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/matchers.js +2 -7
- package/build-module/matchers.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -17,8 +17,7 @@ var _supportedMatchers = _interopRequireDefault(require("./supported-matchers"))
|
|
|
17
17
|
* @param {string} args."0" Name of console method.
|
|
18
18
|
* @param {string} args."1" Name of Jest matcher.
|
|
19
19
|
*/
|
|
20
|
-
const setConsoleMethodSpy =
|
|
21
|
-
let [methodName, matcherName] = _ref;
|
|
20
|
+
const setConsoleMethodSpy = ([methodName, matcherName]) => {
|
|
22
21
|
const spy = jest.spyOn(console, methodName).mockName(`console.${methodName}`);
|
|
23
22
|
/**
|
|
24
23
|
* Resets the spy to its initial state.
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/jest-console/src/index.js"],"names":["setConsoleMethodSpy","methodName","matcherName","spy","jest","spyOn","console","mockName","resetSpy","mockReset","assertionsNumber","assertExpectedCalls","mock","calls","length","expect","not","beforeAll","beforeEach","afterEach","Object","entries","supportedMatchers","forEach"],"mappings":";;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/jest-console/src/index.js"],"names":["setConsoleMethodSpy","methodName","matcherName","spy","jest","spyOn","console","mockName","resetSpy","mockReset","assertionsNumber","assertExpectedCalls","mock","calls","length","expect","not","beforeAll","beforeEach","afterEach","Object","entries","supportedMatchers","forEach"],"mappings":";;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,CAAE,CAAEC,UAAF,EAAcC,WAAd,CAAF,KAAmC;AAC9D,QAAMC,GAAG,GAAGC,IAAI,CACdC,KADU,CACHC,OADG,EACML,UADN,EAEVM,QAFU,CAEC,WAAWN,UAAY,EAFxB,CAAZ;AAIA;AACD;AACA;;AACC,WAASO,QAAT,GAAoB;AACnBL,IAAAA,GAAG,CAACM,SAAJ;AACAN,IAAAA,GAAG,CAACO,gBAAJ,GAAuB,CAAvB;AACA;AAED;AACD;AACA;;;AACC,WAASC,mBAAT,GAA+B;AAC9B,QAAKR,GAAG,CAACO,gBAAJ,KAAyB,CAAzB,IAA8BP,GAAG,CAACS,IAAJ,CAASC,KAAT,CAAeC,MAAf,GAAwB,CAA3D,EAA+D;AAC9DC,MAAAA,MAAM,CAAET,OAAF,CAAN,CAAkBU,GAAlB,CAAuBd,WAAvB;AACA;AACD;;AAEDe,EAAAA,SAAS,CAAET,QAAF,CAAT;AAEAU,EAAAA,UAAU,CAAE,MAAM;AACjBP,IAAAA,mBAAmB;AACnBH,IAAAA,QAAQ;AACR,GAHS,CAAV;AAKAW,EAAAA,SAAS,CAAER,mBAAF,CAAT;AACA,CA9BD;;AAgCAS,MAAM,CAACC,OAAP,CAAgBC,0BAAhB,EAAoCC,OAApC,CAA6CvB,mBAA7C","sourcesContent":["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param {Array} args\n * @param {string} args.\"0\" Name of console method.\n * @param {string} args.\"1\" Name of Jest matcher.\n */\nconst setConsoleMethodSpy = ( [ methodName, matcherName ] ) => {\n\tconst spy = jest\n\t\t.spyOn( console, methodName )\n\t\t.mockName( `console.${ methodName }` );\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\texpect( console ).not[ matcherName ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"]}
|
package/build/matchers.js
CHANGED
|
@@ -25,11 +25,7 @@ const createToHaveBeenCalledMatcher = (matcherName, methodName) => received => {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const createToHaveBeenCalledWith = (matcherName, methodName) => function (received) {
|
|
29
|
-
for (var _len = arguments.length, expected = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30
|
-
expected[_key - 1] = arguments[_key];
|
|
31
|
-
}
|
|
32
|
-
|
|
28
|
+
const createToHaveBeenCalledWith = (matcherName, methodName) => function (received, ...expected) {
|
|
33
29
|
const spy = received[methodName];
|
|
34
30
|
const calls = spy.mock.calls;
|
|
35
31
|
const pass = calls.some(objects => this.equals(objects, expected));
|
|
@@ -41,8 +37,7 @@ const createToHaveBeenCalledWith = (matcherName, methodName) => function (receiv
|
|
|
41
37
|
};
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
expect.extend(Object.entries(_supportedMatchers.default).reduce((result,
|
|
45
|
-
let [methodName, matcherName] = _ref;
|
|
40
|
+
expect.extend(Object.entries(_supportedMatchers.default).reduce((result, [methodName, matcherName]) => {
|
|
46
41
|
const matcherNameWith = `${matcherName}With`;
|
|
47
42
|
return { ...result,
|
|
48
43
|
[matcherName]: createToHaveBeenCalledMatcher(`.${matcherName}`, methodName),
|
package/build/matchers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","printReceived","assertionsNumber","createToHaveBeenCalledWith","expected","some","objects","equals","expect","extend","Object","entries","supportedMatchers","reduce","result","matcherNameWith"],"mappings":";;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,QAAF,IAAgB;AAC9C,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACA,mCAAc,OAAON,WAAa,EAAlC,EAAqCG,GAAG,CAACM,WAAJ,EAArC,IACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWC,+BAAX,CALiB,GAMjB,MACA,mCAAaX,WAAb,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,IACA,MADA,GAEA,sCATH;AAWAN,EAAAA,GAAG,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CAtBF;;AAwBA,MAAMO,0BAA0B,GAAG,CAAEb,WAAF,EAAeC,UAAf,KAClC,UAAWC,QAAX,
|
|
1
|
+
{"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","printReceived","assertionsNumber","createToHaveBeenCalledWith","expected","some","objects","equals","expect","extend","Object","entries","supportedMatchers","reduce","result","matcherNameWith"],"mappings":";;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,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,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CA5BF;;AA8BAY,MAAM,CAACC,MAAP,CACCC,MAAM,CAACC,OAAP,CAAgBC,0BAAhB,EAAoCC,MAApC,CACC,CAAEC,MAAF,EAAU,CAAEvB,UAAF,EAAcD,WAAd,CAAV,KAA2C;AAC1C,QAAMyB,eAAe,GAAI,GAAGzB,WAAa,MAAzC;AAEA,SAAO,EACN,GAAGwB,MADG;AAEN,KAAExB,WAAF,GAAiBD,6BAA6B,CAC5C,IAAIC,WAAa,EAD2B,EAE7CC,UAF6C,CAFxC;AAMN,KAAEwB,eAAF,GAAqBZ,0BAA0B,CAC7C,IAAIY,eAAiB,EADwB,EAE9CxB,UAF8C;AANzC,GAAP;AAWA,CAfF,EAgBC,EAhBD,CADD","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher =\n\t( matcherName, methodName ) => ( received ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.length > 0;\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called.';\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nconst createToHaveBeenCalledWith = ( matcherName, methodName ) =>\n\tfunction ( received, ...expected ) {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.some( ( objects ) =>\n\t\t\tthis.equals( objects, expected )\n\t\t);\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected ) +\n\t\t\t\t\t'\\n' +\n\t\t\t\t\t'but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived );\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nexpect.extend(\n\tObject.entries( supportedMatchers ).reduce(\n\t\t( result, [ methodName, matcherName ] ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -11,8 +11,7 @@ import supportedMatchers from './supported-matchers';
|
|
|
11
11
|
* @param {string} args."1" Name of Jest matcher.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
const setConsoleMethodSpy =
|
|
15
|
-
let [methodName, matcherName] = _ref;
|
|
14
|
+
const setConsoleMethodSpy = ([methodName, matcherName]) => {
|
|
16
15
|
const spy = jest.spyOn(console, methodName).mockName(`console.${methodName}`);
|
|
17
16
|
/**
|
|
18
17
|
* Resets the spy to its initial state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/jest-console/src/index.js"],"names":["supportedMatchers","setConsoleMethodSpy","methodName","matcherName","spy","jest","spyOn","console","mockName","resetSpy","mockReset","assertionsNumber","assertExpectedCalls","mock","calls","length","expect","not","beforeAll","beforeEach","afterEach","Object","entries","forEach"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,YAAP;AACA,OAAOA,iBAAP,MAA8B,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/jest-console/src/index.js"],"names":["supportedMatchers","setConsoleMethodSpy","methodName","matcherName","spy","jest","spyOn","console","mockName","resetSpy","mockReset","assertionsNumber","assertExpectedCalls","mock","calls","length","expect","not","beforeAll","beforeEach","afterEach","Object","entries","forEach"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,YAAP;AACA,OAAOA,iBAAP,MAA8B,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAG,CAAE,CAAEC,UAAF,EAAcC,WAAd,CAAF,KAAmC;AAC9D,QAAMC,GAAG,GAAGC,IAAI,CACdC,KADU,CACHC,OADG,EACML,UADN,EAEVM,QAFU,CAEC,WAAWN,UAAY,EAFxB,CAAZ;AAIA;AACD;AACA;;AACC,WAASO,QAAT,GAAoB;AACnBL,IAAAA,GAAG,CAACM,SAAJ;AACAN,IAAAA,GAAG,CAACO,gBAAJ,GAAuB,CAAvB;AACA;AAED;AACD;AACA;;;AACC,WAASC,mBAAT,GAA+B;AAC9B,QAAKR,GAAG,CAACO,gBAAJ,KAAyB,CAAzB,IAA8BP,GAAG,CAACS,IAAJ,CAASC,KAAT,CAAeC,MAAf,GAAwB,CAA3D,EAA+D;AAC9DC,MAAAA,MAAM,CAAET,OAAF,CAAN,CAAkBU,GAAlB,CAAuBd,WAAvB;AACA;AACD;;AAEDe,EAAAA,SAAS,CAAET,QAAF,CAAT;AAEAU,EAAAA,UAAU,CAAE,MAAM;AACjBP,IAAAA,mBAAmB;AACnBH,IAAAA,QAAQ;AACR,GAHS,CAAV;AAKAW,EAAAA,SAAS,CAAER,mBAAF,CAAT;AACA,CA9BD;;AAgCAS,MAAM,CAACC,OAAP,CAAgBtB,iBAAhB,EAAoCuB,OAApC,CAA6CtB,mBAA7C","sourcesContent":["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param {Array} args\n * @param {string} args.\"0\" Name of console method.\n * @param {string} args.\"1\" Name of Jest matcher.\n */\nconst setConsoleMethodSpy = ( [ methodName, matcherName ] ) => {\n\tconst spy = jest\n\t\t.spyOn( console, methodName )\n\t\t.mockName( `console.${ methodName }` );\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\texpect( console ).not[ matcherName ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"]}
|
package/build-module/matchers.js
CHANGED
|
@@ -20,11 +20,7 @@ const createToHaveBeenCalledMatcher = (matcherName, methodName) => received => {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const createToHaveBeenCalledWith = (matcherName, methodName) => function (received) {
|
|
24
|
-
for (var _len = arguments.length, expected = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
25
|
-
expected[_key - 1] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
|
|
23
|
+
const createToHaveBeenCalledWith = (matcherName, methodName) => function (received, ...expected) {
|
|
28
24
|
const spy = received[methodName];
|
|
29
25
|
const calls = spy.mock.calls;
|
|
30
26
|
const pass = calls.some(objects => this.equals(objects, expected));
|
|
@@ -36,8 +32,7 @@ const createToHaveBeenCalledWith = (matcherName, methodName) => function (receiv
|
|
|
36
32
|
};
|
|
37
33
|
};
|
|
38
34
|
|
|
39
|
-
expect.extend(Object.entries(supportedMatchers).reduce((result,
|
|
40
|
-
let [methodName, matcherName] = _ref;
|
|
35
|
+
expect.extend(Object.entries(supportedMatchers).reduce((result, [methodName, matcherName]) => {
|
|
41
36
|
const matcherNameWith = `${matcherName}With`;
|
|
42
37
|
return { ...result,
|
|
43
38
|
[matcherName]: createToHaveBeenCalledMatcher(`.${matcherName}`, methodName),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["matcherHint","printExpected","printReceived","supportedMatchers","createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","assertionsNumber","createToHaveBeenCalledWith","expected","some","objects","equals","expect","extend","Object","entries","reduce","result","matcherNameWith"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,EAAqCC,aAArC,QAA0D,oBAA1D;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;;AAEA,MAAMC,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,QAAF,IAAgB;AAC9C,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACAX,WAAW,CAAG,OAAOK,WAAa,EAAvB,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,CAAX,GACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWb,aAAX,CALiB,GAMjB,MACAF,WAAW,CAAEK,WAAF,EAAeG,GAAG,CAACM,WAAJ,EAAf,CAAX,GACA,MADA,GAEA,sCATH;AAWAN,EAAAA,GAAG,CAACQ,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNH,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CAtBF;;AAwBA,MAAMM,0BAA0B,GAAG,CAAEZ,WAAF,EAAeC,UAAf,KAClC,UAAWC,QAAX,
|
|
1
|
+
{"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["matcherHint","printExpected","printReceived","supportedMatchers","createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","assertionsNumber","createToHaveBeenCalledWith","expected","some","objects","equals","expect","extend","Object","entries","reduce","result","matcherNameWith"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,EAAqCC,aAArC,QAA0D,oBAA1D;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;;AAEA,MAAMC,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,QAAF,IAAgB;AAC9C,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACAX,WAAW,CAAG,OAAOK,WAAa,EAAvB,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,CAAX,GACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWb,aAAX,CALiB,GAMjB,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,EACN,GAAGsB,MADG;AAEN,KAAEtB,WAAF,GAAiBD,6BAA6B,CAC5C,IAAIC,WAAa,EAD2B,EAE7CC,UAF6C,CAFxC;AAMN,KAAEsB,eAAF,GAAqBX,0BAA0B,CAC7C,IAAIW,eAAiB,EADwB,EAE9CtB,UAF8C;AANzC,GAAP;AAWA,CAfF,EAgBC,EAhBD,CADD","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher =\n\t( matcherName, methodName ) => ( received ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.length > 0;\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called.';\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nconst createToHaveBeenCalledWith = ( matcherName, methodName ) =>\n\tfunction ( received, ...expected ) {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.some( ( objects ) =>\n\t\t\tthis.equals( objects, expected )\n\t\t);\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected ) +\n\t\t\t\t\t'\\n' +\n\t\t\t\t\t'but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived );\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nexpect.extend(\n\tObject.entries( supportedMatchers ).reduce(\n\t\t( result, [ methodName, matcherName ] ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/jest-console",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Custom Jest matchers for the Console object.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed"
|
|
45
45
|
}
|