123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- 'use strict';
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = void 0;
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- class CallTracker {
- constructor() {
- _defineProperty(this, 'track', void 0);
- _defineProperty(this, 'any', void 0);
- _defineProperty(this, 'count', void 0);
- _defineProperty(this, 'argsFor', void 0);
- _defineProperty(this, 'all', void 0);
- _defineProperty(this, 'allArgs', void 0);
- _defineProperty(this, 'first', void 0);
- _defineProperty(this, 'mostRecent', void 0);
- _defineProperty(this, 'reset', void 0);
- let calls = [];
- this.track = function (context) {
- calls.push(context);
- };
- this.any = function () {
- return !!calls.length;
- };
- this.count = function () {
- return calls.length;
- };
- this.argsFor = function (index) {
- const call = calls[index];
- return call ? call.args : [];
- };
- this.all = function () {
- return calls;
- };
- this.allArgs = function () {
- const callArgs = [];
- for (let i = 0; i < calls.length; i++) {
- callArgs.push(calls[i].args);
- }
- return callArgs;
- };
- this.first = function () {
- return calls[0];
- };
- this.mostRecent = function () {
- return calls[calls.length - 1];
- };
- this.reset = function () {
- calls = [];
- };
- }
- }
- var _default = CallTracker;
- exports.default = _default;
|