New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mighty-justice/tester

Package Overview
Dependencies
Maintainers
8
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mighty-justice/tester - npm Package Compare versions

Comparing version 2.0.0-0 to 2.0.0-1

67

dist/tester.cjs.development.js

@@ -865,42 +865,9 @@ 'use strict';

}
function getValue(_x, _x2) {
return _getValue.apply(this, arguments);
function isFunction(value) {
return typeof value === 'function';
}
function _getValue() {
_getValue = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(tester, value) {
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!(typeof value === 'function')) {
_context.next = 6;
break;
}
_context.next = 3;
return value(tester);
case 3:
_context.t0 = _context.sent;
_context.next = 7;
break;
case 6:
_context.t0 = value;
case 7:
return _context.abrupt("return", _context.t0);
case 8:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _getValue.apply(this, arguments);
function getValue(tester, value) {
return isFunction(value) ? value(tester) : value;
}
function sleep(_x3) {
function sleep(_x) {
return _sleep.apply(this, arguments);

@@ -910,6 +877,6 @@ }

function _sleep() {
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(ms) {
return runtime_1.wrap(function _callee2$(_context2) {
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(ms) {
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context.prev = _context.next) {
case 0:

@@ -920,3 +887,3 @@ if (ms === void 0) {

return _context2.abrupt("return", new Promise(function (resolve) {
return _context.abrupt("return", new Promise(function (resolve) {
return setTimeout(resolve, ms);

@@ -927,6 +894,6 @@ }));

case "end":
return _context2.stop();
return _context.stop();
}
}
}, _callee2);
}, _callee);
}));

@@ -944,8 +911,8 @@ return _sleep.apply(this, arguments);

function _flushPromises() {
_flushPromises = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
return runtime_1.wrap(function _callee3$(_context3) {
_flushPromises = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
return runtime_1.wrap(function _callee2$(_context2) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context2.prev = _context2.next) {
case 0:
return _context3.abrupt("return", new Promise(function (resolve, _reject) {
return _context2.abrupt("return", new Promise(function (resolve, _reject) {
return setImmediate(resolve);

@@ -956,6 +923,6 @@ }));

case "end":
return _context3.stop();
return _context2.stop();
}
}
}, _callee3);
}, _callee2);
}));

@@ -962,0 +929,0 @@ return _flushPromises.apply(this, arguments);

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),r=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return i(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var u,c=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function p(){}function l(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,m=d&&d(d(L([])));m&&m!==e&&r.call(m,o)&&(v=m);var y=l.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=y.constructor=l,l.constructor=p,p.displayName=u(l,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(w.prototype),w.prototype[i]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(y),u(y,a,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(u={exports:{}}),u.exports);function s(t,e){return f.apply(this,arguments)}function f(){return(f=o(c.mark((function t(e,r){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof r){t.next=6;break}return t.next=3,r(e);case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=r;case 7:return t.abrupt("return",t.t0);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){return p.apply(this,arguments)}function p(){return(p=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=0),t.abrupt("return",new Promise((function(t){return setTimeout(t,e)})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function l(){return v.apply(this,arguments)}function v(){return(v=o(c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,e){return setImmediate(t)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var d=function(t){return r.createElement(e.Fragment,Object.assign({},t))},m=function(){function t(e,n){var o=this;void 0===n&&(n={}),this.config=t.Configuration,this.initialMount=n.mount,this.onBeforeMount=n.onBeforeMount,this.opts=n,this.props=n.props||{},this.TestedComponent=e,!this.TestedComponent&&this.initialMount&&(this.TestedComponent=d,this.initialMount=r.createElement(this.TestedComponent,null,this.initialMount)),this.config.getValidHooks("onInit").forEach((function(t){return t.onInit(o)}))}var e,n=t.prototype;return n.getWrappers=function(){var t=this,e=[];return this.config.getValidHooks("component").forEach((function(r){e.push({component:r.component,name:r.name,props:s(t,r.props)})})),e},n.debug=function(){console.log(this.wrapper.debug())},n.html=function(){return this.component.html()},n.text=function(){return this.component.text()},n.find=function(t){return this.wrapper.find(t)},n.update=function(){return this.wrapper.update()},n.sleep=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h(e);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n.refresh=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h(e);case 2:this.update();case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getComponent=function(t){return"string"==typeof(e=t)||e instanceof String?this.find(t).first():t;var e},n.changeInput=function(t,e){var r=this.getComponent(t);r.simulate("focus"),r.simulate("change",{target:{value:e}}),r.simulate("blur")},n.checkBox=function(t,e){void 0===e&&(e=!0),this.getComponent(t).simulate("change",{target:{checked:e}})},n.click=function(t){this.getComponent(t).simulate("click")},n.submit=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="form"),this.getComponent(e).simulate("submit"),t.next=5,this.refresh();case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.mount=function(){var t=o(c.mark((function t(e){var n,o,i,u,f,h,p;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===e&&(e={}),n=this.config.getValidHooks("onBeforeMount"),o=a(n);case 3:if((i=o()).done){t.next=9;break}return u=i.value,t.next=7,u.onBeforeMount(this,e);case 7:t.next=3;break;case 9:if(!this.onBeforeMount){t.next=12;break}return t.next=12,this.onBeforeMount(this);case 12:return t.next=14,s(this,this.props);case 14:return f=t.sent,h=this.initialMount||r.createElement(this.TestedComponent,Object.assign({},f)),p=this.getWrappers().reduce((function(t,e){var n=!1!==e.renderChildren&&t;return e.props?r.createElement(e.component,Object.assign({},e.props),n):t}),h),t.next=19,this.config.enzyme.mount(p);case 19:if(this.wrapper=t.sent,!1===e.async){t.next=28;break}if(!this.instance){t.next=24;break}return t.next=24,this.instance.componentDidMount();case 24:return t.next=26,l();case 26:return t.next=28,this.refresh();case 28:return t.abrupt("return",this);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),(e=[{key:"instance",get:function(){return(t=this.component.instance())&&(t.wrappedInstance||t);var t}},{key:"component",get:function(){return this.wrapper.find(this.TestedComponent)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}(),y=new(function(){function t(t){this.hooks={},this.Tester=t,t.Configuration=this}var e=t.prototype;return e.configure=function(t,e){var r=this;return this.enzyme=t,e.hooks&&e.hooks.forEach((function(t){r.registerHook(t)})),this.Tester},e.registerHook=function(t){if(!t.name)throw new Error("Tester.registerHook() : A hooks must have a name.");if(this.hooks[t.name])throw new Error('Tester.registerHook() : A hook named "'+t.name+'" already exist.');this.hooks[t.name]=t},e.getValidHooks=function(t){var e=[];return Object.values(this.hooks).forEach((function(r){var n=!0;t&&!r[t]&&(n=!1),n&&e.push(r)})),e},t}())(m);exports.Tester=m,exports.TesterConfig=y;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),r=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return i(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var u,c=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function p(){}function l(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,m=d&&d(d(L([])));m&&m!==e&&r.call(m,o)&&(v=m);var y=l.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=y.constructor=l,l.constructor=p,p.displayName=u(l,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(w.prototype),w.prototype[i]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(y),u(y,a,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(u={exports:{}}),u.exports);function s(t,e){return function(t){return"function"==typeof t}(e)?e(t):e}function f(t){return h.apply(this,arguments)}function h(){return(h=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=0),t.abrupt("return",new Promise((function(t){return setTimeout(t,e)})));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function p(){return l.apply(this,arguments)}function l(){return(l=o(c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,e){return setImmediate(t)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var v=function(t){return r.createElement(e.Fragment,Object.assign({},t))},d=function(){function t(e,n){var o=this;void 0===n&&(n={}),this.config=t.Configuration,this.initialMount=n.mount,this.onBeforeMount=n.onBeforeMount,this.opts=n,this.props=n.props||{},this.TestedComponent=e,!this.TestedComponent&&this.initialMount&&(this.TestedComponent=v,this.initialMount=r.createElement(this.TestedComponent,null,this.initialMount)),this.config.getValidHooks("onInit").forEach((function(t){return t.onInit(o)}))}var e,n=t.prototype;return n.getWrappers=function(){var t=this,e=[];return this.config.getValidHooks("component").forEach((function(r){e.push({component:r.component,name:r.name,props:s(t,r.props)})})),e},n.debug=function(){console.log(this.wrapper.debug())},n.html=function(){return this.component.html()},n.text=function(){return this.component.text()},n.find=function(t){return this.wrapper.find(t)},n.update=function(){return this.wrapper.update()},n.sleep=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(e);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n.refresh=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(e);case 2:this.update();case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getComponent=function(t){return"string"==typeof(e=t)||e instanceof String?this.find(t).first():t;var e},n.changeInput=function(t,e){var r=this.getComponent(t);r.simulate("focus"),r.simulate("change",{target:{value:e}}),r.simulate("blur")},n.checkBox=function(t,e){void 0===e&&(e=!0),this.getComponent(t).simulate("change",{target:{checked:e}})},n.click=function(t){this.getComponent(t).simulate("click")},n.submit=function(){var t=o(c.mark((function t(e){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="form"),this.getComponent(e).simulate("submit"),t.next=5,this.refresh();case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.mount=function(){var t=o(c.mark((function t(e){var n,o,i,u,f,h,l;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===e&&(e={}),n=this.config.getValidHooks("onBeforeMount"),o=a(n);case 3:if((i=o()).done){t.next=9;break}return u=i.value,t.next=7,u.onBeforeMount(this,e);case 7:t.next=3;break;case 9:if(!this.onBeforeMount){t.next=12;break}return t.next=12,this.onBeforeMount(this);case 12:return t.next=14,s(this,this.props);case 14:return f=t.sent,h=this.initialMount||r.createElement(this.TestedComponent,Object.assign({},f)),l=this.getWrappers().reduce((function(t,e){var n=!1!==e.renderChildren&&t;return e.props?r.createElement(e.component,Object.assign({},e.props),n):t}),h),t.next=19,this.config.enzyme.mount(l);case 19:if(this.wrapper=t.sent,!1===e.async){t.next=28;break}if(!this.instance){t.next=24;break}return t.next=24,this.instance.componentDidMount();case 24:return t.next=26,p();case 26:return t.next=28,this.refresh();case 28:return t.abrupt("return",this);case 29:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),(e=[{key:"instance",get:function(){return(t=this.component.instance())&&(t.wrappedInstance||t);var t}},{key:"component",get:function(){return this.wrapper.find(this.TestedComponent)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}(),m=new(function(){function t(t){this.hooks={},this.Tester=t,t.Configuration=this}var e=t.prototype;return e.configure=function(t,e){var r=this;return this.enzyme=t,e.hooks&&e.hooks.forEach((function(t){r.registerHook(t)})),this.Tester},e.registerHook=function(t){if(!t.name)throw new Error("Tester.registerHook() : A hooks must have a name.");if(this.hooks[t.name])throw new Error('Tester.registerHook() : A hook named "'+t.name+'" already exist.');this.hooks[t.name]=t},e.getValidHooks=function(t){var e=[];return Object.values(this.hooks).forEach((function(r){var n=!0;t&&!r[t]&&(n=!1),n&&e.push(r)})),e},t}())(d);exports.Tester=d,exports.TesterConfig=m;
//# sourceMappingURL=tester.cjs.production.min.js.map

@@ -858,42 +858,9 @@ import React, { Fragment } from 'react';

}
function getValue(_x, _x2) {
return _getValue.apply(this, arguments);
function isFunction(value) {
return typeof value === 'function';
}
function _getValue() {
_getValue = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(tester, value) {
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!(typeof value === 'function')) {
_context.next = 6;
break;
}
_context.next = 3;
return value(tester);
case 3:
_context.t0 = _context.sent;
_context.next = 7;
break;
case 6:
_context.t0 = value;
case 7:
return _context.abrupt("return", _context.t0);
case 8:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _getValue.apply(this, arguments);
function getValue(tester, value) {
return isFunction(value) ? value(tester) : value;
}
function sleep(_x3) {
function sleep(_x) {
return _sleep.apply(this, arguments);

@@ -903,6 +870,6 @@ }

function _sleep() {
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(ms) {
return runtime_1.wrap(function _callee2$(_context2) {
_sleep = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(ms) {
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context.prev = _context.next) {
case 0:

@@ -913,3 +880,3 @@ if (ms === void 0) {

return _context2.abrupt("return", new Promise(function (resolve) {
return _context.abrupt("return", new Promise(function (resolve) {
return setTimeout(resolve, ms);

@@ -920,6 +887,6 @@ }));

case "end":
return _context2.stop();
return _context.stop();
}
}
}, _callee2);
}, _callee);
}));

@@ -937,8 +904,8 @@ return _sleep.apply(this, arguments);

function _flushPromises() {
_flushPromises = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
return runtime_1.wrap(function _callee3$(_context3) {
_flushPromises = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
return runtime_1.wrap(function _callee2$(_context2) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context2.prev = _context2.next) {
case 0:
return _context3.abrupt("return", new Promise(function (resolve, _reject) {
return _context2.abrupt("return", new Promise(function (resolve, _reject) {
return setImmediate(resolve);

@@ -949,6 +916,6 @@ }));

case "end":
return _context3.stop();
return _context2.stop();
}
}
}, _callee3);
}, _callee2);
}));

@@ -955,0 +922,0 @@ return _flushPromises.apply(this, arguments);

export declare function getInstance(component: any): any;
export declare function getValue(tester: any, value: unknown): Promise<any>;
export declare function isFunction(value: unknown): value is Function;
export declare function getValue(tester: any, value: unknown): any;
export declare function sleep(ms?: number): Promise<void>;
export declare function isString(value: unknown): value is string;
export declare function flushPromises(): Promise<void>;
{
"name": "@mighty-justice/tester",
"version": "2.0.0-0",
"version": "2.0.0-1",
"description": "Bootstrap your tests!",

@@ -73,5 +73,5 @@ "main": "dist/index.js",

"tsdx": "^0.14.0",
"typescript": "^4.0.3"
"typescript": "^3"
},
"dependencies": {}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc