Skip to content

Commit da41f5f

Browse files
committed
clarify comments and shrink test scope
1 parent 377e6b0 commit da41f5f

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/test/unittest/noConfigDebugInit.unit.test.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,7 @@ suite('setup for no-config debug scenario', function () {
7171
.setup((x) => x.append(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
7272
.callback((key, value) => {
7373
if (key === 'PATH') {
74-
// The value should be the scripts directory, with or without separator
75-
// depending on whether the current PATH ends with a separator
76-
const pathSeparator = process.platform === 'win32' ? ';' : ':';
77-
const currentPath = process.env.PATH || '';
78-
const needsSeparator = currentPath.length > 0 && !currentPath.endsWith(pathSeparator);
79-
const expectedValue = needsSeparator ? `${pathSeparator}${noConfigScriptsDir}` : noConfigScriptsDir;
80-
assert(value === expectedValue);
74+
assert(value.includes(noConfigScriptsDir));
8175
}
8276
})
8377
.returns(envVarCollectionAppendStub);
@@ -108,19 +102,21 @@ suite('setup for no-config debug scenario', function () {
108102
environmentVariableCollectionMock
109103
.setup((x) => x.replace(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
110104
.returns(envVarCollectionReplaceStub);
111-
105+
112106
environmentVariableCollectionMock
113107
.setup((x) => x.append(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
114108
.callback((key, value) => {
115109
if (key === 'PATH') {
116-
// When PATH already ends with separator, we should NOT add another one
110+
// Since PATH already ends with separator, we should NOT add another one
117111
assert(value === noConfigScriptsDir);
118112
assert(!value.startsWith(pathSeparator));
119113
}
120114
})
121115
.returns(envVarCollectionAppendStub);
122116

123-
context.setup((c) => c.environmentVariableCollection).returns(() => environmentVariableCollectionMock.object);
117+
context
118+
.setup((c) => c.environmentVariableCollection)
119+
.returns(() => environmentVariableCollectionMock.object);
124120

125121
setupFileSystemWatchers();
126122

@@ -153,19 +149,21 @@ suite('setup for no-config debug scenario', function () {
153149
environmentVariableCollectionMock
154150
.setup((x) => x.replace(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
155151
.returns(envVarCollectionReplaceStub);
156-
152+
157153
environmentVariableCollectionMock
158154
.setup((x) => x.append(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
159155
.callback((key, value) => {
160156
if (key === 'PATH') {
161-
// When PATH does not end with separator, we should add one
157+
// Since PATH does NOT end with separator, we should add one
162158
assert(value === `${pathSeparator}${noConfigScriptsDir}`);
163159
assert(value.startsWith(pathSeparator));
164160
}
165161
})
166162
.returns(envVarCollectionAppendStub);
167163

168-
context.setup((c) => c.environmentVariableCollection).returns(() => environmentVariableCollectionMock.object);
164+
context
165+
.setup((c) => c.environmentVariableCollection)
166+
.returns(() => environmentVariableCollectionMock.object);
169167

170168
setupFileSystemWatchers();
171169

0 commit comments

Comments
 (0)