Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
floralan committed Nov 30, 2023
1 parent 8042584 commit eea4233
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"printWidth": 80,
"tabWidth": 2,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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);
});
});
});

0 comments on commit eea4233

Please sign in to comment.