Skip to content

Commit 50ebeed

Browse files
committed
update
1 parent 6cf7bc8 commit 50ebeed

File tree

3 files changed

+183
-159
lines changed

3 files changed

+183
-159
lines changed

__tests__/feature-flag-client.test.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,40 @@ describe('Feature Flag Client', () => {
5454
)
5555
})
5656

57-
it('create or update feature flag', async () => {
57+
it('can create or update feature flag', async () => {
58+
const appConfigEndpoint = 'https://example.com'
59+
const featureFlagId = 'featureFlagId1'
60+
const label = ''
61+
const value = getDummyFeatureFlagItem(featureFlagId)
62+
63+
const getMock = jest.spyOn(axios, 'put').mockResolvedValue({
64+
status: 200
65+
})
66+
67+
await createOrUpdateFeatureFlag(
68+
appConfigEndpoint,
69+
featureFlagId,
70+
value,
71+
label
72+
)
73+
expect(getMock).toBeCalledWith(
74+
`${appConfigEndpoint}/kv/.appconfig.featureflag%2FfeatureFlagId1?api-version=2023-11-01&label=`,
75+
{
76+
content_type:
77+
'application/vnd.microsoft.appconfig.ff+json;charset=utf-8',
78+
value: JSON.stringify(value)
79+
},
80+
{
81+
headers: {
82+
Accept: '*/*',
83+
Authorization: 'Bearer token',
84+
'Content-Type': 'application/vnd.microsoft.appconfig.kv+json'
85+
}
86+
}
87+
)
88+
})
89+
90+
it('can create or update feature flag with non-empty label', async () => {
5891
const appConfigEndpoint = 'https://example.com'
5992
const featureFlagId = 'featureFlagId1'
6093
const label = 'test-label'

0 commit comments

Comments
 (0)