@triviality/core
Version:
Purely typed service container
49 lines • 2 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;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var ImmutableRegistryList_1 = require("../ImmutableRegistryList");
describe('Create makeImmutableRegistryList', function () {
it('empty', function () {
var empty = ImmutableRegistryList_1.makeImmutableRegistryList();
expect(empty.toArray()).toEqual([]);
});
it('With values', function () {
var list = ImmutableRegistryList_1.makeImmutableRegistryList(1, 2);
expect(list.toArray()).toEqual([1, 2]);
});
it('Should be instance of Array and ImmutableRegistryList', function () {
var list = ImmutableRegistryList_1.makeImmutableRegistryList(1, 2);
expect(list).toBeInstanceOf(ImmutableRegistryList_1.ImmutableRegistryList);
expect(list).toBeInstanceOf(Array);
});
it('Can iterate values', function () {
var list = ImmutableRegistryList_1.makeImmutableRegistryList(1, 2);
expect(__spread(list)).toEqual([1, 2]);
});
it('Can add services to new instance', function () {
var list = ImmutableRegistryList_1.makeImmutableRegistryList(1, 2);
var withExtra = list.register(3, 4);
expect(list.toArray()).toEqual([1, 2]);
expect(withExtra.toArray()).toEqual([1, 2, 3, 4]);
});
});
//# sourceMappingURL=ImmutableRegistryList.test.js.map
;