From eea423306c84fc272ce64059f89c553eea318739 Mon Sep 17 00:00:00 2001 From: Flora Lan Date: Thu, 30 Nov 2023 12:46:28 -0800 Subject: [PATCH] test: add test --- .prettierrc | 4 +++- .../test/jest/context/workspaceContext.test.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index 57a1013229..c3ff9895fd 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,7 @@ { "printWidth": 80, "tabWidth": 2, - "singleQuote": true + "singleQuote": true, + "trailingComma": "none", + "arrowParens": "avoid" } diff --git a/packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts b/packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts index e9d04ff8b0..1fc089fc5a 100644 --- a/packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts @@ -7,6 +7,7 @@ import { WorkspaceContextUtil } from '@salesforce/salesforcedx-utils-vscode'; import { WorkspaceContext, workspaceContextUtils } from '../../../src/context'; import { decorators } from '../../../src/decorators'; +import { SfdxProjectConfig } from '../../../src/sfdxProject'; describe('workspaceContext', () => { describe('handleCliConfigChange', () => { @@ -63,4 +64,18 @@ describe('workspaceContext', () => { expect(orgId).not.toBeNull(); }); }); + + describe('getSfdxNamespace', () => { + it('should get the namespace from SfdxProjectConfig', async () => { + const dummyNamespace = 'dummyNamespace'; + const getValueMock = jest + .spyOn(SfdxProjectConfig, 'getValue') + .mockResolvedValue(dummyNamespace); + + const namespace = await WorkspaceContext.getInstance().getSfdxNamespace(); + + expect(getValueMock).toHaveBeenCalledWith('namespace'); + expect(namespace).toEqual(dummyNamespace); + }); + }); });