Skip to content

Commit

Permalink
fix(appconfig): middyjs#1009 fix bug when configuration is returned a…
Browse files Browse the repository at this point in the history
…s empty array
  • Loading branch information
mju-spyrosoft committed Mar 16, 2023
1 parent 9f898a4 commit 77ac83c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/appconfig/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ test.serial(
cacheExpiry: 0,
fetchData: {
key: {
ApplicationIdentifier: 'xb0nby2',
ConfigurationProfileIdentifier: 'ofexqm2',
EnvironmentIdentifier: '7tp0goq'
ApplicationIdentifier: '...',
ConfigurationProfileIdentifier: '...',
EnvironmentIdentifier: '...'
}
}
})
Expand Down Expand Up @@ -127,7 +127,7 @@ test.serial(
)

test.serial(
'It should keep previous configuration value if getLatestConfiguration returns null configuration',
'It should keep previous configuration value if getLatestConfiguration returns empty configuration array',
async (t) => {
mockClient(AppConfigDataClient)
.on(StartConfigurationSessionCommand)
Expand All @@ -148,7 +148,7 @@ test.serial(
})
.resolvesOnce({
ContentType: 'application/json',
Configuration: null,
Configuration: strToUintArray(''),
NextPollConfigurationToken: 'NextConfigToken'
})

Expand Down
2 changes: 1 addition & 1 deletion packages/appconfig/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const appConfigMiddleware = (opts = {}) => {
configurationTokenCache[internalKey] =
configResp.NextPollConfigurationToken

if (configResp.Configuration == null) {
if (configResp.Configuration.length === 0) {
return configurationCache[internalKey]
}

Expand Down

0 comments on commit 77ac83c

Please sign in to comment.