@theia/api-tests 1.24.0-next.45 → 1.24.0-next.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/preferences.spec.js +32 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/api-tests",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.46+173e8b197a2",
|
|
4
4
|
"description": "Theia API tests",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.24.0-next.
|
|
6
|
+
"@theia/core": "1.24.0-next.46+173e8b197a2"
|
|
7
7
|
},
|
|
8
8
|
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
|
|
9
9
|
"repository": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "173e8b197a2a1bbe7f95f49509da7e53659de0c7"
|
|
24
24
|
}
|
package/src/preferences.spec.js
CHANGED
|
@@ -157,4 +157,36 @@ describe('Preferences', function () {
|
|
|
157
157
|
const prefs = await getPreferences();
|
|
158
158
|
shouldBeUndefined(prefs[override], override);
|
|
159
159
|
});
|
|
160
|
+
|
|
161
|
+
it('Handles many synchronous settings of preferences gracefully', async function () {
|
|
162
|
+
let settings = 0;
|
|
163
|
+
const promises = [];
|
|
164
|
+
const searchPref = 'search.searchOnTypeDebouncePeriod'
|
|
165
|
+
const channelPref = 'output.maxChannelHistory'
|
|
166
|
+
const hoverPref = 'workbench.hover.delay';
|
|
167
|
+
let searchDebounce;
|
|
168
|
+
let channelHistory;
|
|
169
|
+
let hoverDelay;
|
|
170
|
+
/** @type import ('@theia/core/src/browser/preferences/preference-service').PreferenceChanges | undefined */
|
|
171
|
+
let event;
|
|
172
|
+
const toDispose = preferenceService.onPreferencesChanged(e => event = e);
|
|
173
|
+
while (settings++ < 50) {
|
|
174
|
+
searchDebounce = 100 + Math.floor(Math.random() * 500);
|
|
175
|
+
channelHistory = 200 + Math.floor(Math.random() * 800);
|
|
176
|
+
hoverDelay = 250 + Math.floor(Math.random() * 2_500);
|
|
177
|
+
promises.push(
|
|
178
|
+
preferenceService.set(searchPref, searchDebounce),
|
|
179
|
+
preferenceService.set(channelPref, channelHistory),
|
|
180
|
+
preferenceService.set(hoverPref, hoverDelay)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const results = await Promise.allSettled(promises);
|
|
184
|
+
const expectedValues = { [searchPref]: searchDebounce, [channelPref]: channelHistory, [hoverPref]: hoverDelay };
|
|
185
|
+
const actualValues = { [searchPref]: preferenceService.get(searchPref), [channelPref]: preferenceService.get(channelPref), [hoverPref]: preferenceService.get(hoverPref), }
|
|
186
|
+
const eventValues = event && Object.keys(event).reduce((accu, key) => { accu[key] = event[key].newValue; return accu; }, {});
|
|
187
|
+
toDispose.dispose();
|
|
188
|
+
assert(results.every(setting => setting.status === 'fulfilled'), 'All promises should have resolved rather than rejected.');
|
|
189
|
+
assert.deepEqual(actualValues, eventValues, 'The event should reflect the current state of the service.');
|
|
190
|
+
assert.deepEqual(expectedValues, actualValues, 'The service state should reflect the most recent setting');
|
|
191
|
+
});
|
|
160
192
|
});
|