Skip to content

Commit 92a01a4

Browse files
committed
Rename createGlobalPersistentStoreStub to get...
1 parent 057f8be commit 92a01a4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/client/pythonEnvironments/base/envsCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { cloneDeep } from 'lodash';
55
import { IFileSystem } from '../../common/platform/types';
66
import { IPersistentState } from '../../common/types';
7-
import { createGlobalPersistentStore } from '../common/externalDependencies';
7+
import { getGlobalPersistentStore } from '../common/externalDependencies';
88
import { areSameEnvironment, PartialPythonEnvironment } from '../info';
99
import { PythonEnvInfo } from './info';
1010

@@ -68,7 +68,7 @@ export class PythonEnvInfoCache implements IEnvsCache {
6868
}
6969

7070
this.initialized = true;
71-
this.persistentStorage = createGlobalPersistentStore<PythonEnvInfo[]>('PYTHON_ENV_INFO_CACHE');
71+
this.persistentStorage = getGlobalPersistentStore<PythonEnvInfo[]>('PYTHON_ENV_INFO_CACHE');
7272
this.envsList = this.persistentStorage?.value;
7373
}
7474

src/client/pythonEnvironments/common/externalDependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function getPersistentStateFactory(): IPersistentStateFactory {
4343
return internalServiceContainer.get<IPersistentStateFactory>(IPersistentStateFactory);
4444
}
4545

46-
export function createGlobalPersistentStore<T>(key: string): IPersistentState<T> {
46+
export function getGlobalPersistentStore<T>(key: string): IPersistentState<T> {
4747
const factory = getPersistentStateFactory();
4848
return factory.createGlobalPersistentState<T>(key, undefined);
4949
}

src/test/pythonEnvironments/base/envsCache.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as externalDependencies from '../../../client/pythonEnvironments/common
99
import * as envInfo from '../../../client/pythonEnvironments/info';
1010

1111
suite('Environment Info cache', () => {
12-
let createGlobalPersistentStoreStub: sinon.SinonStub;
12+
let getGlobalPersistentStoreStub: sinon.SinonStub;
1313
let areSameEnvironmentStub: sinon.SinonStub;
1414
let updatedValues: PythonEnvInfo[] | undefined;
1515

@@ -32,8 +32,8 @@ suite('Environment Info cache', () => {
3232
(env1: PythonEnvInfo, env2:PythonEnvInfo) => env1.name === env2.name,
3333
);
3434

35-
createGlobalPersistentStoreStub = sinon.stub(externalDependencies, 'createGlobalPersistentStore');
36-
createGlobalPersistentStoreStub.returns({
35+
getGlobalPersistentStoreStub = sinon.stub(externalDependencies, 'getGlobalPersistentStore');
36+
getGlobalPersistentStoreStub.returns({
3737
value: envInfoArray,
3838
updateValue: async (envs: PythonEnvInfo[]) => {
3939
updatedValues = envs;
@@ -43,7 +43,7 @@ suite('Environment Info cache', () => {
4343
});
4444

4545
teardown(() => {
46-
createGlobalPersistentStoreStub.restore();
46+
getGlobalPersistentStoreStub.restore();
4747
areSameEnvironmentStub.restore();
4848
updatedValues = undefined;
4949
});
@@ -53,13 +53,13 @@ suite('Environment Info cache', () => {
5353

5454
envsCache.initialize();
5555

56-
assert.ok(createGlobalPersistentStoreStub.calledOnce);
56+
assert.ok(getGlobalPersistentStoreStub.calledOnce);
5757
});
5858

5959
test('The in-memory env info array is undefined if there is no value in persistent storage when initializing the cache', () => {
6060
const envsCache = new PythonEnvInfoCache(allEnvsComplete);
6161

62-
createGlobalPersistentStoreStub.returns({ value: undefined });
62+
getGlobalPersistentStoreStub.returns({ value: undefined });
6363
envsCache.initialize();
6464
const result = envsCache.getAllEnvs();
6565

0 commit comments

Comments
 (0)