UNPKG

singletons

Version:

Helps create and manage families of singletons based on customizable conditions

22 lines (17 loc) 435 B
import {expect} from 'chai'; import {SingletonFactory} from '../../src/singletons'; describe(`Testing README.md examples`, function () { it('Function singleton(key) example', function () { class Class { constructor () {} }; const Singleton = SingletonFactory( Class, [ 'object', ] ); const s1 = Singleton(console); expect(Singleton.singleton('o1')).to.equal(s1); }); });