first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import { appendFunction } from './appendFunction';
describe('appendFunction', function () {
it('can append 2 functions', function () {
var counter = 0;
var function1 = function () { return counter++; };
var function2 = function () { return counter++; };
var function3 = appendFunction({}, function1, function2);
function3();
expect(counter).toEqual(2);
});
it('can deal with falsey values', function () {
var counter = 0;
var function1 = function () { return counter++; };
var function2 = function () { return counter++; };
var function3 = appendFunction({}, function1, undefined, null, function2);
function3();
expect(counter).toEqual(2);
});
it('preserves the parent', function () {
function add() {
this.counter++;
}
var Foo = /** @class */ (function () {
function Foo() {
this.counter = 0;
this.add = appendFunction(this, add, this.add);
}
Foo.prototype.add = function () {
this.counter++;
};
return Foo;
}());
var foo = new Foo();
foo.add();
expect(foo.counter).toEqual(2);
});
});
//# sourceMappingURL=appendFunction.test.js.map