Skip to content

Commit a58738a

Browse files
committed
Revert to default to 0 for falsy feature values
1 parent 07d4cad commit a58738a

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/features/utils/aggregate-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class AggregateBase extends FeatureBase {
114114
}
115115
function buildOutput (ref) {
116116
return flagNames.map(flag => {
117-
if (ref[flag] === undefined) return null
117+
if (!ref[flag]) return 0
118118
return ref[flag]
119119
})
120120
}

tests/unit/features/utils/aggregate-base.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ test('should not perform late configuration checks in AggregateBase', () => {
7777
})
7878

7979
test('should resolve waitForFlags correctly based on flags with real vals', async () => {
80-
// the 4th flag is missing to emulate missing rum response
81-
const flagNames = [faker.string.uuid(), faker.string.uuid(), faker.string.uuid(), faker.string.uuid()]
80+
const flagNames = [faker.string.uuid(), faker.string.uuid(), faker.string.uuid()]
8281
const aggregateBase = new AggregateBase(mainAgent, featureName)
8382
const flagWait = aggregateBase.waitForFlags(flagNames)
8483
aggregateBase.ee.emit('rumresp', [{
@@ -89,8 +88,7 @@ test('should resolve waitForFlags correctly based on flags with real vals', asyn
8988
'not-expected1': 1,
9089
'not-expected2': 2
9190
}])
92-
// use null to avoid locking into 0/OFF mode
93-
await expect(flagWait).resolves.toEqual([0, 1, 2, null])
91+
await expect(flagWait).resolves.toEqual([0, 1, 2])
9492
})
9593

9694
test('should return empty array when flagNames is empty', async () => {

0 commit comments

Comments
 (0)