Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adjust tests for cds^8 #662

Merged
merged 7 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions sqlite/test/deep/deepInputProcessing.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const cds = require('../../../test/cds')

const { POST, PUT } = cds.test(__dirname, 'deep.cds')
const { POST, PUT, GET } = cds.test(__dirname, 'deep.cds')

describe('UUID Generation', () => {
test('generate UUID on insert', async () => {
Expand Down Expand Up @@ -55,10 +55,12 @@ describe('UUID Generation', () => {
})
expect(resUpdate.status).toBe(200)

const resRead = await GET(`/bla/RootUUID(${uuid})?$expand=toOneChild($expand=toManySubChild)`)

// foreign keys are set correctly (deep)
expect(resUpdate.data.toOneChild.ID).toEqual(resUpdate.data.toOneChild_ID)
expect(resUpdate.data.toOneChild.ID).toEqual(resUpdate.data.toOneChild.toManySubChild[0].backlink_ID)
expect(resUpdate.data.toOneChild.ID).toEqual(resUpdate.data.toOneChild.toManySubChild[1].backlink_ID)
expect(resRead.data.toOneChild.ID).toEqual(resRead.data.toOneChild_ID)
expect(resRead.data.toOneChild.ID).toEqual(resRead.data.toOneChild.toManySubChild[0].backlink_ID)
expect(resRead.data.toOneChild.ID).toEqual(resRead.data.toOneChild.toManySubChild[1].backlink_ID)
})

test('generate UUID on update programmatically', async () => {
Expand Down Expand Up @@ -124,11 +126,16 @@ describe('UUID Generation', () => {
toOneChild: null,
})
expect(resUpdate.status).toBe(200)

expect(resUpdate.data).toMatchObject({
'@odata.context': '$metadata#RootUUID/$entity',
ID: uuid,
name: null,
})

const resRead = await GET(`/bla/RootUUID(${uuid})?$expand=toOneChild`)
expect(resRead.data).toMatchObject({
ID: uuid,
name: null,
toOneChild: null,
})
})
Expand Down
2 changes: 1 addition & 1 deletion sqlite/test/lean-draft.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ describe('draft tests', () => {
Price: null,
CurrencyCode_code: null,
to_Booking_BookingUUID: BookingUUID,
to_Travel_TravelUUID: null, // Should be TravelUUID!
to_Travel_TravelUUID: TravelUUID,
sjvans marked this conversation as resolved.
Show resolved Hide resolved
to_Supplement_SupplementID: null,
HasActiveEntity: false,
IsActiveEntity: false,
Expand Down
Loading