@triviality/core
Version:
Purely typed service container
35 lines • 1.56 kB
JavaScript
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var ServiceFactory_1 = require("../ServiceFactory");
it('Can wrap services as sf', function () {
var _a = __read(ServiceFactory_1.AllAsServiceFactory([1, 2]), 2), one = _a[0], two = _a[1];
expect(one()).toEqual(1);
expect(two()).toEqual(2);
});
it('assetServiceFactory should be a function without arguments', function () {
expect(function () { return ServiceFactory_1.assetServiceFactory(1); }).toThrowError();
expect(function () { return ServiceFactory_1.assetServiceFactory(function (foo) { return foo; }); }).toThrowError();
expect(ServiceFactory_1.assetServiceFactory(function () { return 1; })).toEqual(true);
});
it('Can wrap services as sf', function () {
expect(function () { return ServiceFactory_1.assertServiceTag(1); }).toThrowError();
expect(function () { return ServiceFactory_1.assertServiceTag(''); }).toThrowError();
expect(ServiceFactory_1.assertServiceTag('my tag')).toEqual(true);
});
//# sourceMappingURL=ServiceFactory.test.js.map
;