Skip to content

Commit ad12008

Browse files
committed
remove workaround for null label
1 parent 6522085 commit ad12008

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/AzureAppConfigurationImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class AzureAppConfigurationImpl extends Map<string, any> implements Azure
101101
keyValues.push(keyValuePair);
102102
}
103103
// update etag of sentinels
104-
const matchedSentinel = this._sentinels?.find(s => s.key === setting.key && (s.label ?? null) === setting.label); // Workaround: as undefined label represents the same with null.
104+
const matchedSentinel = this._sentinels.find(s => s.key === setting.key && s.label === setting.label);
105105
if (matchedSentinel) {
106106
matchedSentinel.etag = setting.etag;
107107
}

test/utils/testHelper.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { AppConfigurationClient, ConfigurationSetting } from "@azure/app-configu
66
import { ClientSecretCredential } from "@azure/identity";
77
import { KeyVaultSecret, SecretClient } from "@azure/keyvault-secrets";
88
import * as uuid from "uuid";
9+
import { RestError } from "@azure/core-rest-pipeline";
910

1011
const TEST_CLIENT_ID = "00000000-0000-0000-0000-000000000000";
1112
const TEST_TENANT_ID = "00000000-0000-0000-0000-000000000000";
@@ -39,15 +40,15 @@ function mockAppConfigurationClientListConfigurationSettings(kvList: Configurati
3940

4041
function mockAppConfigurationClientGetConfigurationSetting(kvList) {
4142
sinon.stub(AppConfigurationClient.prototype, "getConfigurationSetting").callsFake((settingId, options) => {
42-
const key = settingId.key;
43-
const label = settingId.label ?? null;
44-
const found = kvList.find(elem => elem.key === key && elem.label === label);
43+
const found = kvList.find(elem => elem.key === settingId.key && elem.label === settingId.label);
4544
if (found) {
4645
if (options?.onlyIfChanged && settingId.etag === found.etag) {
4746
return { statusCode: 304 };
4847
} else {
4948
return { statusCode: 200, ...found };
5049
}
50+
} else {
51+
throw new RestError("", { statusCode: 404 });
5152
}
5253
});
5354
}

0 commit comments

Comments
 (0)