import { DyNTS_Service_Collection } from './service-collection.service'; class TestService { name: string; constructor(name: string) { this.name = name; } } describe('| DyNTS_Service_Collection', () => { it('| should be a singleton instance', () => { class TestCollection extends DyNTS_Service_Collection { static getInstance(): TestCollection { return TestCollection.getSingletonInstance(); } } const instance1 = TestCollection.getInstance(); const instance2 = TestCollection.getInstance(); expect(instance1).toBe(instance2); expect(instance1).toBeInstanceOf(TestCollection); }); it('| should allow dynamic property assignment', () => { class TestCollection extends DyNTS_Service_Collection { static getInstance(): TestCollection { return TestCollection.getSingletonInstance(); } } const collection = TestCollection.getInstance(); const service1 = new TestService('service1'); const service2 = new TestService('service2'); collection['service1'] = service1; collection['service2'] = service2; expect(collection['service1']).toBe(service1); expect(collection['service2']).toBe(service2); expect(collection['service1'].name).toBe('service1'); expect(collection['service2'].name).toBe('service2'); }); });