@@ -6,7 +6,7 @@ import * as chaiAsPromised from "chai-as-promised";
66chai . use ( chaiAsPromised ) ;
77const expect = chai . expect ;
88import { load } from "./exportedApi" ;
9- import { mockAppConfigurationClientListConfigurationSettings , restoreMocks , createMockedConnectionString , createMockedEnpoint , createMockedTokenCredential , createMockedKeyValue } from "./utils/testHelper" ;
9+ import { mockAppConfigurationClientListConfigurationSettings , restoreMocks , createMockedConnectionString , createMockedEndpoint , createMockedTokenCredential , createMockedKeyValue } from "./utils/testHelper" ;
1010
1111const mockedKVs = [ {
1212 key : "app.settings.fontColor" ,
@@ -62,6 +62,17 @@ const mockedKVs = [{
6262} , {
6363 key : "app5.settings" ,
6464 value : "placeholder"
65+ } , {
66+ key : ".appconfig.featureflag/Beta" ,
67+ value : JSON . stringify ( {
68+ "id" : "Beta" ,
69+ "description" : "" ,
70+ "enabled" : true ,
71+ "conditions" : {
72+ "client_filters" : [ ]
73+ }
74+ } ) ,
75+ contentType : "application/vnd.microsoft.appconfig.ff+json;charset=utf-8"
6576}
6677] . map ( createMockedKeyValue ) ;
6778
@@ -84,7 +95,7 @@ describe("load", function () {
8495 } ) ;
8596
8697 it ( "should load data from config store with aad + endpoint URL" , async ( ) => {
87- const endpoint = createMockedEnpoint ( ) ;
98+ const endpoint = createMockedEndpoint ( ) ;
8899 const credential = createMockedTokenCredential ( ) ;
89100 const settings = await load ( new URL ( endpoint ) , credential ) ;
90101 expect ( settings ) . not . undefined ;
@@ -93,7 +104,7 @@ describe("load", function () {
93104 } ) ;
94105
95106 it ( "should load data from config store with aad + endpoint string" , async ( ) => {
96- const endpoint = createMockedEnpoint ( ) ;
107+ const endpoint = createMockedEndpoint ( ) ;
97108 const credential = createMockedTokenCredential ( ) ;
98109 const settings = await load ( endpoint , credential ) ;
99110 expect ( settings ) . not . undefined ;
@@ -110,6 +121,13 @@ describe("load", function () {
110121 return expect ( load ( "invalid-endpoint-url" , credential ) ) . eventually . rejectedWith ( "Invalid endpoint URL." ) ;
111122 } ) ;
112123
124+ it ( "should not include feature flags directly in the settings" , async ( ) => {
125+ const connectionString = createMockedConnectionString ( ) ;
126+ const settings = await load ( connectionString ) ;
127+ expect ( settings ) . not . undefined ;
128+ expect ( settings . get ( ".appconfig.featureflag/Beta" ) ) . undefined ;
129+ } ) ;
130+
113131 it ( "should filter by key and label, has(key) and get(key) should work" , async ( ) => {
114132 const connectionString = createMockedConnectionString ( ) ;
115133 const settings = await load ( connectionString , {
@@ -251,7 +269,7 @@ describe("load", function () {
251269 expect ( settings . get ( "TestKey" ) ) . eq ( "TestValueForProd" ) ;
252270 } ) ;
253271
254- it ( "should dedup exact same selectors but keeping the precedence" , async ( ) => {
272+ it ( "should deduplicate exact same selectors but keeping the precedence" , async ( ) => {
255273 const connectionString = createMockedConnectionString ( ) ;
256274 const settings = await load ( connectionString , {
257275 selectors : [ {
@@ -317,7 +335,7 @@ describe("load", function () {
317335 * key: "app3.settings.fontColor" => value: "yellow"
318336 *
319337 * get() will return "placeholder" for "app3.settings" and "yellow" for "app3.settings.fontColor", as expected.
320- * data.app3.settings will return "placeholder" as a whole JSON object, which is not guarenteed to be correct.
338+ * data.app3.settings will return "placeholder" as a whole JSON object, which is not guaranteed to be correct.
321339 */
322340 it ( "Edge case 1: Hierarchical key-value pairs with overlapped key prefix." , async ( ) => {
323341 const connectionString = createMockedConnectionString ( ) ;
@@ -337,7 +355,7 @@ describe("load", function () {
337355 * key: "app5.settings.fontColor" => value: "yellow"
338356 * key: "app5.settings" => value: "placeholder"
339357 *
340- * When ocnstructConfigurationObject () is called, it first constructs from key "app5.settings.fontColor" and then from key "app5.settings".
358+ * When constructConfigurationObject () is called, it first constructs from key "app5.settings.fontColor" and then from key "app5.settings".
341359 * An error will be thrown when constructing from key "app5.settings" because there is ambiguity between the two keys.
342360 */
343361 it ( "Edge case 1: Hierarchical key-value pairs with overlapped key prefix." , async ( ) => {
0 commit comments