|
|
@ -2180,7 +2180,7 @@ function linkBased() { |
|
|
|
|
|
|
|
|
|
|
|
// Other scenarios
|
|
|
|
// Other scenarios
|
|
|
|
// Has-many : change an existing link to a new one
|
|
|
|
// Has-many : change an existing link to a new one
|
|
|
|
it('Change an existing link to a new one', async function () { |
|
|
|
it('HM: Change an existing link to a new one', async function () { |
|
|
|
// add a link
|
|
|
|
// add a link
|
|
|
|
await ncAxiosLinkAdd({ |
|
|
|
await ncAxiosLinkAdd({ |
|
|
|
urlParams: { |
|
|
|
urlParams: { |
|
|
@ -2209,12 +2209,8 @@ function linkBased() { |
|
|
|
rowId: 1, |
|
|
|
rowId: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
let subResponse = rsp.body.list.map(({ Id, City }) => ({ Id, City })); |
|
|
|
expect(rsp.body.list.length).to.equal(1); |
|
|
|
expect(subResponse.length).to.equal(1); |
|
|
|
expect(rsp.body.list).to.deep.equal([{ Id: 1, City: 'City 1' }]); |
|
|
|
expect(subResponse[0]).to.deep.equal({ |
|
|
|
|
|
|
|
Id: 1, |
|
|
|
|
|
|
|
City: 'City 1', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rsp = await ncAxiosLinkGet({ |
|
|
|
rsp = await ncAxiosLinkGet({ |
|
|
|
urlParams: { |
|
|
|
urlParams: { |
|
|
@ -2224,13 +2220,10 @@ function linkBased() { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
expect(rsp.body.list.length).to.equal(2); |
|
|
|
expect(rsp.body.list.length).to.equal(2); |
|
|
|
subResponse = rsp.body.list.map(({ Id, City }) => ({ Id, City })); |
|
|
|
expect(rsp.body.list).to.deep.equal([ |
|
|
|
for (let i = 2; i <= 3; i++) { |
|
|
|
{ Id: 2, City: 'City 2' }, |
|
|
|
expect(subResponse[i - 2]).to.deep.equal({ |
|
|
|
{ Id: 3, City: 'City 3' }, |
|
|
|
Id: i, |
|
|
|
]); |
|
|
|
City: `City ${i}`, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// limit & offset verification
|
|
|
|
// limit & offset verification
|
|
|
|