diff --git a/.gitignore b/.gitignore index 6392214..633113f 100644 --- a/.gitignore +++ b/.gitignore @@ -96,3 +96,4 @@ jspm_packages/ # parcel-bundler cache (https://parceljs.org/) .cache +/.idea diff --git a/package.json b/package.json index af224af..b20455a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@salesforce/vscode-service-provider", - "version": "0.0.1", + "version": "0.0.1-aplha.0", "description": "Library that provides access to Salesforce VSCode Service Provider", "main": "index.js", "author": "Peter Hale ", diff --git a/test/services/serviceProvider.test.ts b/test/services/serviceProvider.test.ts index 878eaf4..e707c94 100644 --- a/test/services/serviceProvider.test.ts +++ b/test/services/serviceProvider.test.ts @@ -46,4 +46,34 @@ describe('ServiceProvider', () => { const hasInstance = ServiceProvider.has(ServiceType.Logger, 'instance1'); expect(hasInstance).toBe(true); }); + it('should remove a service instance', async () => { + (vscode.commands.executeCommand as jest.Mock).mockResolvedValue( + 'mockService' + ); + await ServiceProvider.getService(ServiceType.Logger, 'instance1'); + ServiceProvider.remove(ServiceType.Logger, 'instance1'); + const hasInstance = ServiceProvider.has(ServiceType.Logger, 'instance1'); + expect(hasInstance).toBe(false); + }); + + it('should remove a service', async () => { + (vscode.commands.executeCommand as jest.Mock).mockResolvedValue( + 'mockService' + ); + await ServiceProvider.getService(ServiceType.Logger, 'instance1'); + ServiceProvider.removeService(ServiceType.Logger); + const hasService = ServiceProvider.hasService(ServiceType.Logger); + expect(hasService).toBe(false); + }); + + it('should clear all services', async () => { + (vscode.commands.executeCommand as jest.Mock).mockResolvedValue( + 'mockService' + ); + await ServiceProvider.getService(ServiceType.Logger, 'instance1'); + await ServiceProvider.getService(ServiceType.Logger, 'instance2'); + ServiceProvider.clearAllServices(); + const hasService = ServiceProvider.hasService(ServiceType.Logger); + expect(hasService).toBe(false); + }); });