import { DyNTS_SingletonServiceBase } from './singleton.service-base'; class TestSingletonService extends DyNTS_SingletonServiceBase { static getInstance(): TestSingletonService { return TestSingletonService.getSingletonInstance(); } } describe('| DyNTS_SingletonServiceBase', () => { it('| should return the same instance on multiple calls', () => { const instance1 = TestSingletonService.getInstance(); const instance2 = TestSingletonService.getInstance(); expect(instance1).toBe(instance2); expect(instance1).toBeInstanceOf(TestSingletonService); }); it('| should create instance only once', () => { const instance1 = TestSingletonService.getInstance(); const instance2 = TestSingletonService.getInstance(); const instance3 = TestSingletonService.getInstance(); expect(instance1).toBe(instance2); expect(instance2).toBe(instance3); }); });