Creating All Items
Not too long read about how create all items.
describe('myContainer', () => {
it('creates all items', () => {
expect({ ...container }).toEqual(container);
});
});const items = { ...container }; // using spread operator
// or
const { ...items } = container; // using rest and destructuringtype Container = {
x: number,
y: number,
z: number,
};
const container = diContainer<Container>(Object.create(null, {
x: { value: () => 1, enumerable: true },
y: { value: () => 2, enumerable: true },
z: { value: () => 3, enumerable: false },
}));
const items = { ...container };
console.log({ z: items.z });
// prints: { z: undefined }
console.log({
isXReady: isReady(container, 'x'),
isYReady: isReady(container, 'y'),
isZReady: isReady(container, 'z'),
});
// prints: { isXReady: true, isYReady: true, isZReady: false }Last updated