Fix scope test

This commit is contained in:
Daniel Imms 2023-05-25 04:53:50 -07:00
parent 37ad81ccd9
commit d1be423950
No known key found for this signature in database
GPG key ID: E5CF412B63651C69

View file

@ -879,18 +879,22 @@ import { assertNoRpc, poll } from '../utils';
collection.append('B', '~b2~');
collection.prepend('C', '~c2~');
// Verify get for scope
const defaultOptions: Required<EnvironmentVariableMutatorOptions> = {
applyAtProcessCreation: true,
applyAtShellIntegration: false
};
const expectedScopedCollection = collection.getScopedEnvironmentVariableCollection(scope);
deepStrictEqual(expectedScopedCollection.get('A'), { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: {} });
deepStrictEqual(expectedScopedCollection.get('B'), { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: {} });
deepStrictEqual(expectedScopedCollection.get('C'), { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: {} });
deepStrictEqual(expectedScopedCollection.get('A'), { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions });
deepStrictEqual(expectedScopedCollection.get('B'), { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions });
deepStrictEqual(expectedScopedCollection.get('C'), { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions });
// Verify forEach
const entries: [string, EnvironmentVariableMutator][] = [];
expectedScopedCollection.forEach((v, m) => entries.push([v, m]));
deepStrictEqual(entries.map(v => v[1]), [
{ value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: {} },
{ value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: {} },
{ value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: {} }
{ value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions },
{ value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions },
{ value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions }
]);
});
});