@johanblumenberg/ts-mockito
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -5,5 +5,5 @@ import { Matcher } from "./matcher/type/Matcher"; | ||
declare class Watcher { | ||
private _err; | ||
private _invoked; | ||
constructor(_err: Error); | ||
private err; | ||
private inv; | ||
constructor(err: Error); | ||
invoked(): void; | ||
@@ -10,0 +10,0 @@ private nextTick; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Watcher = (function () { | ||
function Watcher(_err) { | ||
function Watcher(err) { | ||
var _this = this; | ||
this._err = _err; | ||
this._invoked = false; | ||
this.err = err; | ||
this.inv = false; | ||
this.nextTick = function () { | ||
if (!_this._invoked) { | ||
throw _this._err; | ||
if (!_this.inv) { | ||
throw _this.err; | ||
} | ||
@@ -16,3 +16,3 @@ }; | ||
Watcher.prototype.invoked = function () { | ||
this._invoked = true; | ||
this.inv = true; | ||
}; | ||
@@ -19,0 +19,0 @@ return Watcher; |
@@ -129,2 +129,3 @@ "use strict"; | ||
Object.defineProperty(this.instance, key, { | ||
enumerable: true, | ||
get: this.createActionListener(key), | ||
@@ -134,6 +135,10 @@ }); | ||
Mocker.prototype.createInstanceActionListener = function (key, prototype) { | ||
var _this = this; | ||
if (this.instance.hasOwnProperty(key)) { | ||
return; | ||
} | ||
this.instance[key] = this.createActionListener(key); | ||
Object.defineProperty(this.instance, key, { | ||
enumerable: false, | ||
get: function () { return _this.createActionListener(key); }, | ||
}); | ||
}; | ||
@@ -185,10 +190,5 @@ Mocker.prototype.createActionListener = function (key) { | ||
Object.defineProperty(this.instance, key, { | ||
get: function () { | ||
if (isProperty) { | ||
return _this.createActionListener(key)(); | ||
} | ||
else { | ||
return _this.createActionListener(key); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true, | ||
get: function () { return _this.createActionListener(key)(); }, | ||
}); | ||
@@ -205,3 +205,9 @@ var propertyMock = function () { | ||
} | ||
isProperty = false; | ||
if (isProperty) { | ||
isProperty = false; | ||
Object.defineProperty(_this.instance, key, { | ||
enumerable: _this.mock.__policy === MockPropertyPolicy.StubAsProperty, | ||
get: function () { return _this.createActionListener(key); }, | ||
}); | ||
} | ||
methodToMock.matchers = args.map(function (arg) { return (arg instanceof Matcher_1.Matcher) ? arg : ts_mockito_1.strictEqual(arg); }); | ||
@@ -208,0 +214,0 @@ return methodToMock; |
{ | ||
"name": "@johanblumenberg/ts-mockito", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Mocking library for TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/ts-mockito.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
143670
2129