1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix failing unit test

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-02-24 08:57:41 -05:00
parent 0c1c7b3996
commit c5cbe6367a

View File

@ -41,19 +41,22 @@ export class ApiManager {
const apis = chain(this.dependencies.apis.get().values()) const apis = chain(this.dependencies.apis.get().values())
.concat(this.externalApis.values()); .concat(this.externalApis.values());
const removedApis = new Set(this.apis.values()); const removedApis = new Set(this.apis.values());
const newState = new Map(this.apis);
for (const api of apis) { for (const api of apis) {
removedApis.delete(api); removedApis.delete(api);
this.apis.set(api.apiBase, api); newState.set(api.apiBase, api);
} }
for (const api of removedApis) { for (const api of removedApis) {
for (const [apiBase, storedApi] of this.apis) { for (const [apiBase, storedApi] of newState) {
if (storedApi === api) { if (storedApi === api) {
this.apis.delete(apiBase); newState.delete(apiBase);
} }
} }
} }
this.apis.replace(newState);
}); });
} }