Skip to content

Commit

Permalink
add feature flag test
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi committed Dec 26, 2023
1 parent 828e26b commit 14fd76e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions webapp/src/modules/features/selectors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
getIsSmartWearablesFTUEnabled,
isLoadingFeatureFlags,
getIsNewNavbarDropdownEnabled,
getIsBuyCrossChainEnabled
getIsBuyCrossChainEnabled,
getIsAuthDappEnabled
} from './selectors'
import { FeatureName } from './types'

Expand Down Expand Up @@ -221,10 +222,16 @@ const waitForInitialLoadingSelectors = [
name: 'buy-crosschain',
feature: FeatureName.BUY_CROSS_CHAIN,
selector: getIsBuyCrossChainEnabled
},
{
name: 'auth-dapp',
feature: FeatureName.AUTH_DAPP,
selector: getIsAuthDappEnabled,
applicationName: ApplicationName.DAPPS
}
]

waitForInitialLoadingSelectors.forEach(({ name, feature, selector }) =>
waitForInitialLoadingSelectors.forEach(({ name, feature, applicationName, selector }) =>
describe(`when getting if the ${name} feature flag is enabled`, () => {
describe('when the initial flags have not been yet loaded', () => {
beforeEach(() => {
Expand Down Expand Up @@ -255,7 +262,7 @@ waitForInitialLoadingSelectors.forEach(({ name, feature, selector }) =>
expect(isEnabled).toBe(false)
expect(getIsFeatureEnabledMock).toHaveBeenCalledWith(
state,
ApplicationName.MARKETPLACE,
applicationName || ApplicationName.MARKETPLACE,
feature
)
})
Expand All @@ -272,7 +279,7 @@ waitForInitialLoadingSelectors.forEach(({ name, feature, selector }) =>
expect(isEnabled).toBe(true)
expect(getIsFeatureEnabledMock).toHaveBeenCalledWith(
state,
ApplicationName.MARKETPLACE,
applicationName || ApplicationName.MARKETPLACE,
feature
)
})
Expand Down

0 comments on commit 14fd76e

Please sign in to comment.