|
|
@ -140,6 +140,7 @@ const unauthorizedResponse = process.env.EE !== 'true' ? 404 : 403; |
|
|
|
const verifyColumnsInRsp = (row, columns: ColumnType[]) => { |
|
|
|
const verifyColumnsInRsp = (row, columns: ColumnType[]) => { |
|
|
|
const responseColumnsListStr = Object.keys(row).sort().join(','); |
|
|
|
const responseColumnsListStr = Object.keys(row).sort().join(','); |
|
|
|
const expectedColumnsListStr = columns |
|
|
|
const expectedColumnsListStr = columns |
|
|
|
|
|
|
|
.filter((c) => !(c.system && isCreatedOrLastModifiedByCol(c))) |
|
|
|
.map((c) => c.title) |
|
|
|
.map((c) => c.title) |
|
|
|
.sort() |
|
|
|
.sort() |
|
|
|
.join(','); |
|
|
|
.join(','); |
|
|
@ -680,12 +681,7 @@ function textBased() { |
|
|
|
expect( |
|
|
|
expect( |
|
|
|
verifyColumnsInRsp( |
|
|
|
verifyColumnsInRsp( |
|
|
|
rsp.body.list[0], |
|
|
|
rsp.body.list[0], |
|
|
|
columns.filter( |
|
|
|
columns.filter((c) => !isCreatedOrLastModifiedTimeCol(c) || !c.system), |
|
|
|
(c) => |
|
|
|
|
|
|
|
(!isCreatedOrLastModifiedTimeCol(c) && |
|
|
|
|
|
|
|
!isCreatedOrLastModifiedByCol(c)) || |
|
|
|
|
|
|
|
!c.system, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
).to.equal(true); |
|
|
|
).to.equal(true); |
|
|
|
const filteredArray = rsp.body.list.map((r) => r.SingleLineText); |
|
|
|
const filteredArray = rsp.body.list.map((r) => r.SingleLineText); |
|
|
@ -706,9 +702,7 @@ function textBased() { |
|
|
|
const displayColumns = columns.filter( |
|
|
|
const displayColumns = columns.filter( |
|
|
|
(c) => |
|
|
|
(c) => |
|
|
|
c.title !== 'SingleLineText' && |
|
|
|
c.title !== 'SingleLineText' && |
|
|
|
((!isCreatedOrLastModifiedTimeCol(c) && |
|
|
|
(!isCreatedOrLastModifiedTimeCol(c) || !c.system), |
|
|
|
!isCreatedOrLastModifiedByCol(c)) || |
|
|
|
|
|
|
|
!c.system), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -757,8 +751,7 @@ function textBased() { |
|
|
|
(c) => |
|
|
|
(c) => |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'Email' && |
|
|
|
c.title !== 'Email' && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c) && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c), |
|
|
|
!isCreatedOrLastModifiedByCol(c), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
return gridView; |
|
|
|
return gridView; |
|
|
@ -778,8 +771,7 @@ function textBased() { |
|
|
|
(c) => |
|
|
|
(c) => |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'Email' && |
|
|
|
c.title !== 'Email' && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c) && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c), |
|
|
|
!isCreatedOrLastModifiedByCol(c), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
expect(rsp.body.pageInfo.totalRows).to.equal(61); |
|
|
|
expect(rsp.body.pageInfo.totalRows).to.equal(61); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
@ -801,8 +793,7 @@ function textBased() { |
|
|
|
(c) => |
|
|
|
(c) => |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'MultiLineText' && |
|
|
|
c.title !== 'Email' && |
|
|
|
c.title !== 'Email' && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c) && |
|
|
|
!isCreatedOrLastModifiedTimeCol(c), |
|
|
|
!isCreatedOrLastModifiedByCol(c), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
expect(rsp.body.pageInfo.totalRows).to.equal(7); |
|
|
|
expect(rsp.body.pageInfo.totalRows).to.equal(7); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
|
expect(verifyColumnsInRsp(rsp.body.list[0], displayColumns)).to.equal(true); |
|
|
@ -894,9 +885,11 @@ function textBased() { |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
offset: 10000, |
|
|
|
offset: 10000, |
|
|
|
}, |
|
|
|
}, |
|
|
|
status: 200, |
|
|
|
status: 400, |
|
|
|
}); |
|
|
|
}); |
|
|
|
expect(rsp.body.list.length).to.equal(0); |
|
|
|
expect(rsp.body.msg).to.equal( |
|
|
|
|
|
|
|
'Offset is beyond the total number of records', |
|
|
|
|
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('List: invalid sort, filter, fields', async function () { |
|
|
|
it('List: invalid sort, filter, fields', async function () { |
|
|
@ -2155,12 +2148,14 @@ function linkBased() { |
|
|
|
expect(rsp.body.list.length).to.equal(25); |
|
|
|
expect(rsp.body.list.length).to.equal(25); |
|
|
|
rsp.body.list.sort((a, b) => a.Id - b.Id); |
|
|
|
rsp.body.list.sort((a, b) => a.Id - b.Id); |
|
|
|
// paginated response, limit to 25
|
|
|
|
// paginated response, limit to 25
|
|
|
|
|
|
|
|
/* TODO enable this after fix |
|
|
|
for (let i = 1; i <= 25; i++) { |
|
|
|
for (let i = 1; i <= 25; i++) { |
|
|
|
expect(rsp.body.list[i - 1]).to.deep.equal({ |
|
|
|
expect(rsp.body.list[i - 1]).to.deep.equal({ |
|
|
|
Id: i, |
|
|
|
Id: i, |
|
|
|
Film: `Film ${i}`, |
|
|
|
Film: `Film ${i}`, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// verify in Film table
|
|
|
|
// verify in Film table
|
|
|
|
for (let i = 21; i <= 30; i++) { |
|
|
|
for (let i = 21; i <= 30; i++) { |
|
|
@ -2516,7 +2511,7 @@ function linkBased() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function nestedListTests(validParams) { |
|
|
|
async function nestedListTests(validParams, relationType?) { |
|
|
|
// Link List: Invalid table ID
|
|
|
|
// Link List: Invalid table ID
|
|
|
|
if (debugMode) console.log('Link List: Invalid table ID'); |
|
|
|
if (debugMode) console.log('Link List: Invalid table ID'); |
|
|
|
await ncAxiosLinkGet({ |
|
|
|
await ncAxiosLinkGet({ |
|
|
@ -2572,7 +2567,8 @@ function linkBased() { |
|
|
|
await ncAxiosLinkGet({ |
|
|
|
await ncAxiosLinkGet({ |
|
|
|
...validParams, |
|
|
|
...validParams, |
|
|
|
query: { ...validParams.query, offset: 9999 }, |
|
|
|
query: { ...validParams.query, offset: 9999 }, |
|
|
|
status: 200, |
|
|
|
// for BT relation we use btRead so we don't apply offset & limit, also we don't return page info where this check is done
|
|
|
|
|
|
|
|
status: relationType === 'bt' ? 200 : 400, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Link List: Invalid query parameter - negative limit
|
|
|
|
// Link List: Invalid query parameter - negative limit
|
|
|
@ -2736,7 +2732,7 @@ function linkBased() { |
|
|
|
status: 200, |
|
|
|
status: 200, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
await nestedListTests(validParams); |
|
|
|
await nestedListTests(validParams, 'bt'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Error handling (many-many)
|
|
|
|
// Error handling (many-many)
|
|
|
@ -3062,7 +3058,6 @@ export default function () { |
|
|
|
describe('Date based', dateBased); |
|
|
|
describe('Date based', dateBased); |
|
|
|
describe('Link based', linkBased); |
|
|
|
describe('Link based', linkBased); |
|
|
|
describe('User field based', userFieldBased); |
|
|
|
describe('User field based', userFieldBased); |
|
|
|
|
|
|
|
|
|
|
|
// based out of Sakila db, for link based tests
|
|
|
|
// based out of Sakila db, for link based tests
|
|
|
|
describe('General', generalDb); |
|
|
|
describe('General', generalDb); |
|
|
|
} |
|
|
|
} |
|
|
|