import { __extends } from "tslib"; import * as React from 'react'; import { mount } from 'enzyme'; import { extendComponent } from './extendComponent'; describe('extendComponent', function () { it('can extend a component with custom lifetime methods', function () { var didMount = 0; var willUnmount = 0; var Foo = /** @class */ (function (_super) { __extends(Foo, _super); function Foo(props) { var _this = _super.call(this, props) || this; extendComponent(_this, { componentDidMount: function () { return didMount++; }, componentWillUnmount: function () { return willUnmount++; }, }); return _this; } Foo.prototype.componentDidMount = function () { didMount++; }; Foo.prototype.componentWillUnmount = function () { willUnmount++; }; Foo.prototype.render = function () { return React.createElement("div", null); }; return Foo; }(React.Component)); var wrapper = mount(React.createElement(Foo, null)); wrapper.unmount(); expect(didMount).toEqual(2); expect(willUnmount).toEqual(2); }); }); //# sourceMappingURL=extendComponent.test.js.map