Skip to content

Commit

Permalink
feat(pageref route): add route to mappedPageRef
Browse files Browse the repository at this point in the history
  • Loading branch information
neo-reply-lukas committed Feb 28, 2024
1 parent a027c1e commit 59cdb9a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/CaaSMapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,16 @@ describe('CaaSMapper', () => {
remoteProjectId
)
})
it('should map route', async () => {
const mapper = new CaaSMapper(createApi(), 'de', {}, createLogger())
const path = createPath()
const pageRef = createPageRef()

const mappedPageRef = await mapper.mapPageRef(pageRef, path)

expect(mappedPageRef.route).toBeTruthy()
expect(mappedPageRef.route).toEqual(pageRef.route)
})
})

describe('mapProjectProperties', () => {
Expand Down
1 change: 1 addition & 0 deletions src/modules/CaaSMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ export class CaaSMapper {
),
}),
remoteProjectId,
route: pageRef.route,
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/testutils/createPageRef.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import faker from 'faker'
import { createDataEntry } from './createDataEntry'
import { CaaSApi_Body, CaaSApi_PageRef } from '../types'

Expand All @@ -24,5 +25,6 @@ export function createPageRef(
fsType: 'PageTemplate',
},
},
route: `/${faker.random.word()}/${faker.random.word()}/`,
}
}
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ export interface CaaSApi_PageRef {
page: CaaSApi_Page
displayName: string
metaFormData?: CaaSApi_DataEntries
route: string
}

export interface CaaSApi_Media_Base {
Expand Down Expand Up @@ -564,6 +565,7 @@ export interface Page {
meta: DataEntries
metaPageRef?: DataEntries
remoteProjectId?: string
route: string
}

export interface Reference {
Expand Down

0 comments on commit 59cdb9a

Please sign in to comment.