Skip to content

Commit

Permalink
fix: map server-config value for null correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi authored and shauke committed Mar 8, 2021
1 parent f0c3255 commit fef26d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ describe('Server Config Mapper', () => {
it(`should return the ServerConfig when getting ServerConfigData`, () => {
const config = ServerConfigMapper.fromData({
data: {
application: { applicationType: 'intershop.B2CResponsive', id: 'application', urlIdentifier: '-' },
application: {
applicationType: 'intershop.B2CResponsive',
id: 'application',
urlIdentifier: '-',
// tslint:disable-next-line: no-null-keyword
displayName: null,
},
basket: { acceleration: true, id: 'basket' },
general: { id: 'general', locales: ['en_US', 'de_DE'] },
services: {
Expand All @@ -22,6 +28,7 @@ describe('Server Config Mapper', () => {
Object {
"application": Object {
"applicationType": "intershop.B2CResponsive",
"displayName": null,
"urlIdentifier": "-",
},
"basket": Object {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/models/server-config/server-config.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ServerConfigMapper {
(acc, entry) => ({
...acc,
[entry[0]]:
typeof entry[1] === 'object' && !Array.isArray(entry[1])
entry[1] !== null && typeof entry[1] === 'object' && !Array.isArray(entry[1])
? // do recursion if we find an object
ServerConfigMapper.mapEntries(
// get rid of id
Expand Down

0 comments on commit fef26d9

Please sign in to comment.