Skip to content

Commit

Permalink
add getEnvFile Function to api
Browse files Browse the repository at this point in the history
  • Loading branch information
paulacamargo25 committed Feb 1, 2023
1 parent 5e16d78 commit a4b9bf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/client/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface IExtensionApi {
*/
execCommand: string[] | undefined;
};
getEnvFile(workspaceFolder?:Uri) : string;
};

datascience: {
Expand Down
13 changes: 13 additions & 0 deletions src/test/api.functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ suite('Extension API', () => {
assert.deepEqual(execDetails, { execCommand: undefined });
});

test('getEnvFile API returns expected object if interpreter is set', async () => {
const resource = Uri.parse('a');
when(configurationService.getSettings(resource)).thenReturn({ envFile: 'envFile' } as any);

const envFile = buildApi(
Promise.resolve(),
instance(serviceManager),
instance(serviceContainer),
).settings.getEnvFile(resource);

assert.equal(envFile, 'envFile');
});

test('Provide a callback which is called when interpreter setting changes', async () => {
const expectedEvent = Typemoq.Mock.ofType<Event<Uri | undefined>>().object;
when(interpreterService.onDidChangeInterpreterConfiguration).thenReturn(expectedEvent);
Expand Down

0 comments on commit a4b9bf1

Please sign in to comment.