|
|
@ -1,8 +1,9 @@ |
|
|
|
import 'mocha'; |
|
|
|
import 'mocha'; |
|
|
|
|
|
|
|
import request from 'supertest'; |
|
|
|
|
|
|
|
import { UITypes } from 'nocodb-sdk'; |
|
|
|
|
|
|
|
import { expect } from 'chai'; |
|
|
|
import init from '../../init'; |
|
|
|
import init from '../../init'; |
|
|
|
import { createProject, createSakilaProject } from '../../factory/project'; |
|
|
|
import { createProject, createSakilaProject } from '../../factory/project'; |
|
|
|
import request from 'supertest'; |
|
|
|
|
|
|
|
import { ColumnType, UITypes } from 'nocodb-sdk'; |
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
createColumn, |
|
|
|
createColumn, |
|
|
|
createLookupColumn, |
|
|
|
createLookupColumn, |
|
|
@ -11,18 +12,18 @@ import { |
|
|
|
} from '../../factory/column'; |
|
|
|
} from '../../factory/column'; |
|
|
|
import { createTable, getTable } from '../../factory/table'; |
|
|
|
import { createTable, getTable } from '../../factory/table'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
|
|
|
|
createBulkRows, |
|
|
|
createChildRow, |
|
|
|
createChildRow, |
|
|
|
createRow, |
|
|
|
createRow, |
|
|
|
generateDefaultRowAttributes, |
|
|
|
generateDefaultRowAttributes, |
|
|
|
getOneRow, |
|
|
|
getOneRow, |
|
|
|
getRow, |
|
|
|
getRow, |
|
|
|
listRow, |
|
|
|
listRow, |
|
|
|
createBulkRows, |
|
|
|
|
|
|
|
} from '../../factory/row'; |
|
|
|
} from '../../factory/row'; |
|
|
|
import { isMysql, isPg, isSqlite } from '../../init/db'; |
|
|
|
import { isMysql, isPg, isSqlite } from '../../init/db'; |
|
|
|
import Model from '../../../../src/models/Model'; |
|
|
|
import type { ColumnType } from 'nocodb-sdk'; |
|
|
|
import Project from '../../../../src/models/Project'; |
|
|
|
import type Model from '../../../../src/models/Model'; |
|
|
|
import { expect } from 'chai'; |
|
|
|
import type Project from '../../../../src/models/Project'; |
|
|
|
|
|
|
|
|
|
|
|
const isColumnsCorrectInResponse = (row, columns: ColumnType[]) => { |
|
|
|
const isColumnsCorrectInResponse = (row, columns: ColumnType[]) => { |
|
|
|
const responseColumnsListStr = Object.keys(row).sort().join(','); |
|
|
|
const responseColumnsListStr = Object.keys(row).sort().join(','); |
|
|
@ -160,7 +161,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Get desc sorted table data list with required columns', async function () { |
|
|
|
it('Get desc sorted table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
const sortInfo = [{ fk_column_id: firstNameColumn.id, direction: 'desc' }]; |
|
|
|
const sortInfo = [{ fk_column_id: firstNameColumn.id, direction: 'desc' }]; |
|
|
@ -214,7 +215,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Get asc sorted table data list with required columns', async function () { |
|
|
|
it('Get asc sorted table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
const sortInfo = [{ fk_column_id: firstNameColumn.id, direction: 'asc' }]; |
|
|
|
const sortInfo = [{ fk_column_id: firstNameColumn.id, direction: 'asc' }]; |
|
|
@ -427,7 +428,7 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const paymentListColumn = (await rentalTable.getColumns()).find( |
|
|
|
const paymentListColumn = (await rentalTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Payment List' |
|
|
|
(c) => c.title === 'Payment List', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const nestedFilter = { |
|
|
|
const nestedFilter = { |
|
|
@ -513,11 +514,11 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const paymentListColumn = (await rentalTable.getColumns()).find( |
|
|
|
const paymentListColumn = (await rentalTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Payment List' |
|
|
|
(c) => c.title === 'Payment List', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const returnDateColumn = (await rentalTable.getColumns()).find( |
|
|
|
const returnDateColumn = (await rentalTable.getColumns()).find( |
|
|
|
(c) => c.title === 'ReturnDate' |
|
|
|
(c) => c.title === 'ReturnDate', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const nestedFilter = { |
|
|
|
const nestedFilter = { |
|
|
@ -630,15 +631,15 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Payment List' |
|
|
|
(c) => c.title === 'Payment List', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Active' |
|
|
|
(c) => c.title === 'Active', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const addressColumn = (await customerTable.getColumns()).find( |
|
|
|
const addressColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Address' |
|
|
|
(c) => c.title === 'Address', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const nestedFilter = [ |
|
|
|
const nestedFilter = [ |
|
|
@ -786,11 +787,11 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Payment List' |
|
|
|
(c) => c.title === 'Payment List', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Active' |
|
|
|
(c) => c.title === 'Active', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const nestedFields = { |
|
|
|
const nestedFields = { |
|
|
@ -866,7 +867,7 @@ function tableTest() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const nestedRentalResponse = Object.keys( |
|
|
|
const nestedRentalResponse = Object.keys( |
|
|
|
ascResponse.body.list[0]['Rental List'] |
|
|
|
ascResponse.body.list[0]['Rental List'], |
|
|
|
); |
|
|
|
); |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
nestedRentalResponse.includes('ReturnDate') && |
|
|
|
nestedRentalResponse.includes('ReturnDate') && |
|
|
@ -914,7 +915,7 @@ function tableTest() { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
(response.body.list as Array<any>).every( |
|
|
|
(response.body.list as Array<any>).every( |
|
|
|
(row) => |
|
|
|
(row) => |
|
|
|
parseInt(row['Formula']) !== parseInt(row[rollupColumnTitle]) + 10 |
|
|
|
parseInt(row['Formula']) !== parseInt(row[rollupColumnTitle]) + 10, |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
throw new Error('Wrong formula'); |
|
|
|
throw new Error('Wrong formula'); |
|
|
@ -998,13 +999,13 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Find one sorted table data list with required columns', async function () { |
|
|
|
it('Find one sorted table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
const visibleColumns = [firstNameColumn]; |
|
|
|
|
|
|
|
|
|
|
|
let response = await request(context.app) |
|
|
|
let response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1025,7 +1026,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
response = await request(context.app) |
|
|
|
response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1047,7 +1048,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Find one desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
it('Find one desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
@ -1064,7 +1065,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1095,11 +1096,11 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
const paymentListColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Payment List' |
|
|
|
(c) => c.title === 'Payment List', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
const activeColumn = (await customerTable.getColumns()).find( |
|
|
|
(c) => c.title === 'Active' |
|
|
|
(c) => c.title === 'Active', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const nestedFields = { |
|
|
|
const nestedFields = { |
|
|
@ -1154,7 +1155,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const ascResponse = await request(context.app) |
|
|
|
const ascResponse = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/find-one`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1181,7 +1182,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Groupby desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
it('Groupby desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
@ -1198,7 +1199,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/groupby` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/groupby`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1217,7 +1218,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
it('Groupby desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
it('Groupby desc sorted and with rollup table data list with required columns', async function () { |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
(col) => col.title === 'FirstName', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
|
const rollupColumn = await createRollupColumn(context, { |
|
|
@ -1234,7 +1235,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/groupby` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/groupby`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1262,7 +1263,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const readResponse = await request(context.app) |
|
|
|
const readResponse = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${row['CustomerId']}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${row['CustomerId']}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1275,6 +1276,35 @@ function tableTest() { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('Read table row with nested fields', async () => { |
|
|
|
|
|
|
|
const rowId = 1; |
|
|
|
|
|
|
|
const actorTable = await getTable({ |
|
|
|
|
|
|
|
project: sakilaProject, |
|
|
|
|
|
|
|
name: 'actor', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
|
|
|
|
.get( |
|
|
|
|
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/`, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.set('xc-auth', context.token) |
|
|
|
|
|
|
|
.query({ |
|
|
|
|
|
|
|
'nested[Film List][fields]': 'Title,ReleaseYear,Language', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.expect(200); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const record = response.body; |
|
|
|
|
|
|
|
expect(record['Film List']).length(19); |
|
|
|
|
|
|
|
expect(record['Film List'][0]).to.have.all.keys( |
|
|
|
|
|
|
|
'Title', |
|
|
|
|
|
|
|
'ReleaseYear', |
|
|
|
|
|
|
|
'Language', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
expect(record['Film List'][0]['Language']).to.have.all.keys( |
|
|
|
|
|
|
|
'Name', |
|
|
|
|
|
|
|
'LanguageId', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Update table row', async function () { |
|
|
|
it('Update table row', async function () { |
|
|
|
const table = await createTable(context, project); |
|
|
|
const table = await createTable(context, project); |
|
|
|
const row = await createRow(context, { project, table }); |
|
|
|
const row = await createRow(context, { project, table }); |
|
|
@ -1398,7 +1428,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!(response.body.message[0] as string).includes( |
|
|
|
!(response.body.message[0] as string).includes( |
|
|
|
'is a LinkToAnotherRecord of' |
|
|
|
'is a LinkToAnotherRecord of', |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
throw new Error('Should give ltar foreign key error'); |
|
|
|
throw new Error('Should give ltar foreign key error'); |
|
|
@ -1413,7 +1443,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${row['CustomerId']}/exist` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${row['CustomerId']}/exist`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1426,7 +1456,7 @@ function tableTest() { |
|
|
|
it('Exist should be false table row when it does not exists', async function () { |
|
|
|
it('Exist should be false table row when it does not exists', async function () { |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/998546/exist` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/998546/exist`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1533,7 +1563,7 @@ function tableTest() { |
|
|
|
.patch(`/api/v1/db/data/bulk/noco/${project.id}/${table.id}`) |
|
|
|
.patch(`/api/v1/db/data/bulk/noco/${project.id}/${table.id}`) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.send( |
|
|
|
.send( |
|
|
|
rows.map((row) => ({ title: `new-${row['Title']}`, id: row['Id'] })) |
|
|
|
rows.map((row) => ({ title: `new-${row['Title']}`, id: row['Id'] })), |
|
|
|
) |
|
|
|
) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|
const updatedRows: Array<any> = await listRow({ project, table }); |
|
|
|
const updatedRows: Array<any> = await listRow({ project, table }); |
|
|
@ -1614,7 +1644,7 @@ function tableTest() { |
|
|
|
it('Export csv', async () => { |
|
|
|
it('Export csv', async () => { |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/export/csv` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/export/csv`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1633,14 +1663,14 @@ function tableTest() { |
|
|
|
it('Export excel', async () => { |
|
|
|
it('Export excel', async () => { |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/export/excel` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/export/excel`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!response['header']['content-disposition'].includes( |
|
|
|
!response['header']['content-disposition'].includes( |
|
|
|
'Customer-export.xlsx' |
|
|
|
'Customer-export.xlsx', |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
throw new Error('Wrong file name'); |
|
|
|
throw new Error('Wrong file name'); |
|
|
@ -1655,11 +1685,11 @@ function tableTest() { |
|
|
|
it('Nested row list hm', async () => { |
|
|
|
it('Nested row list hm', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1674,11 +1704,11 @@ function tableTest() { |
|
|
|
it('Nested row list hm with limit and offset', async () => { |
|
|
|
it('Nested row list hm with limit and offset', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1700,11 +1730,11 @@ function tableTest() { |
|
|
|
it('Row list hm with invalid table id', async () => { |
|
|
|
it('Row list hm with invalid table id', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/wrong-id/${rowId}/hm/${rentalListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/wrong-id/${rowId}/hm/${rentalListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1752,11 +1782,11 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmTable = await getTable({ project: sakilaProject, name: 'film' }); |
|
|
|
const filmTable = await getTable({ project: sakilaProject, name: 'film' }); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1776,11 +1806,11 @@ function tableTest() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmTable = await getTable({ project: sakilaProject, name: 'film' }); |
|
|
|
const filmTable = await getTable({ project: sakilaProject, name: 'film' }); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -1807,11 +1837,11 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1825,12 +1855,12 @@ function tableTest() { |
|
|
|
it('Create hm relation with invalid table id', async () => { |
|
|
|
it('Create hm relation with invalid table id', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/hm/${rentalListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/hm/${rentalListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1843,12 +1873,12 @@ function tableTest() { |
|
|
|
it('Create hm relation with non ltar column', async () => { |
|
|
|
it('Create hm relation with non ltar column', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'FirstName' |
|
|
|
(column) => column.title === 'FirstName', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${firstNameColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${firstNameColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1865,7 +1895,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/invalid-column/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/invalid-column/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1900,20 +1930,20 @@ function tableTest() { |
|
|
|
it('Create list hm', async () => { |
|
|
|
it('Create list hm', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseBeforeUpdate = await request(context.app) |
|
|
|
const lisResponseBeforeUpdate = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1921,7 +1951,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseAfterUpdate = await request(context.app) |
|
|
|
const lisResponseAfterUpdate = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -1944,7 +1974,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/invalid-column/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/invalid-column/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1964,12 +1994,12 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const firstNameColumn = (await actorTable.getColumns()).find( |
|
|
|
const firstNameColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'FirstName' |
|
|
|
(column) => column.title === 'FirstName', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${firstNameColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${firstNameColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -1987,13 +2017,13 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(400); |
|
|
|
.expect(400); |
|
|
@ -2009,20 +2039,20 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 2; |
|
|
|
const refId = 2; |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseBeforeUpdate = await request(context.app) |
|
|
|
const lisResponseBeforeUpdate = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2030,7 +2060,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseAfterUpdate = await request(context.app) |
|
|
|
const lisResponseAfterUpdate = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2046,12 +2076,12 @@ function tableTest() { |
|
|
|
it('List hm with non ltar column', async () => { |
|
|
|
it('List hm with non ltar column', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'FirstName' |
|
|
|
(column) => column.title === 'FirstName', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${firstNameColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${firstNameColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(400); |
|
|
|
.expect(400); |
|
|
@ -2060,12 +2090,12 @@ function tableTest() { |
|
|
|
it('List mm with non ltar column', async () => { |
|
|
|
it('List mm with non ltar column', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
const firstNameColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'FirstName' |
|
|
|
(column) => column.title === 'FirstName', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/mm/${firstNameColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/mm/${firstNameColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(400); |
|
|
|
.expect(400); |
|
|
@ -2078,20 +2108,20 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseBeforeDelete = await request(context.app) |
|
|
|
const lisResponseBeforeDelete = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|
|
|
|
|
|
|
|
|
await request(context.app) |
|
|
|
await request(context.app) |
|
|
|
.delete( |
|
|
|
.delete( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2099,7 +2129,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const lisResponseAfterDelete = await request(context.app) |
|
|
|
const lisResponseAfterDelete = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2118,13 +2148,13 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 76; |
|
|
|
const refId = 76; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.delete( |
|
|
|
.delete( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/${refId}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(400); |
|
|
|
.expect(400); |
|
|
@ -2132,7 +2162,7 @@ function tableTest() { |
|
|
|
// todo: only keep generic error message once updated in noco catchError middleware
|
|
|
|
// todo: only keep generic error message once updated in noco catchError middleware
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!response.body.message?.includes( |
|
|
|
!response.body.message?.includes( |
|
|
|
"The column 'customer_id' cannot be null" |
|
|
|
"The column 'customer_id' cannot be null", |
|
|
|
) && |
|
|
|
) && |
|
|
|
!response.body.message?.includes("Column 'customer_id' cannot be null") && |
|
|
|
!response.body.message?.includes("Column 'customer_id' cannot be null") && |
|
|
|
!response.body.message?.includes('Cannot add or update a child row') && |
|
|
|
!response.body.message?.includes('Cannot add or update a child row') && |
|
|
@ -2141,7 +2171,7 @@ function tableTest() { |
|
|
|
) { |
|
|
|
) { |
|
|
|
console.log( |
|
|
|
console.log( |
|
|
|
'Delete list hm with existing ref row id with non nullable clause', |
|
|
|
'Delete list hm with existing ref row id with non nullable clause', |
|
|
|
response.body |
|
|
|
response.body, |
|
|
|
); |
|
|
|
); |
|
|
|
throw new Error('Wrong error message'); |
|
|
|
throw new Error('Wrong error message'); |
|
|
|
} |
|
|
|
} |
|
|
@ -2171,7 +2201,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.delete( |
|
|
|
.delete( |
|
|
|
`/api/v1/db/data/noco/${project.id}/${table.id}/${row['Id']}/hm/${ltarColumn.id}/${childRow['Id']}` |
|
|
|
`/api/v1/db/data/noco/${project.id}/${table.id}/${row['Id']}/hm/${ltarColumn.id}/${childRow['Id']}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2182,7 +2212,9 @@ function tableTest() { |
|
|
|
throw new Error('Was not deleted'); |
|
|
|
throw new Error('Was not deleted'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (response.body['msg'] !== 'The relation data has been deleted successfully') { |
|
|
|
if ( |
|
|
|
|
|
|
|
response.body['msg'] !== 'The relation data has been deleted successfully' |
|
|
|
|
|
|
|
) { |
|
|
|
throw new Error('Response incorrect'); |
|
|
|
throw new Error('Response incorrect'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -2190,12 +2222,12 @@ function tableTest() { |
|
|
|
it('Exclude list hm', async () => { |
|
|
|
it('Exclude list hm', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2209,12 +2241,12 @@ function tableTest() { |
|
|
|
it('Exclude list hm with limit and offset', async () => { |
|
|
|
it('Exclude list hm with limit and offset', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/${rowId}/hm/${rentalListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -2241,12 +2273,12 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2264,12 +2296,12 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${actorTable.id}/${rowId}/mm/${filmListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -2296,12 +2328,12 @@ function tableTest() { |
|
|
|
name: 'address', |
|
|
|
name: 'address', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const cityColumn = (await addressTable.getColumns()).find( |
|
|
|
const cityColumn = (await addressTable.getColumns()).find( |
|
|
|
(column) => column.title === 'City' |
|
|
|
(column) => column.title === 'City', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
@ -2317,12 +2349,12 @@ function tableTest() { |
|
|
|
name: 'address', |
|
|
|
name: 'address', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const cityColumn = (await addressTable.getColumns()).find( |
|
|
|
const cityColumn = (await addressTable.getColumns()).find( |
|
|
|
(column) => column.title === 'City' |
|
|
|
(column) => column.title === 'City', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.query({ |
|
|
|
.query({ |
|
|
@ -2338,12 +2370,12 @@ function tableTest() { |
|
|
|
it('Create nested hm relation with invalid table id', async () => { |
|
|
|
it('Create nested hm relation with invalid table id', async () => { |
|
|
|
const rowId = 1; |
|
|
|
const rowId = 1; |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
const rentalListColumn = (await customerTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Rental List' |
|
|
|
(column) => column.title === 'Rental List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const refId = 1; |
|
|
|
const refId = 1; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/hm/${rentalListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/hm/${rentalListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -2361,11 +2393,11 @@ function tableTest() { |
|
|
|
name: 'actor', |
|
|
|
name: 'actor', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
const filmListColumn = (await actorTable.getColumns()).find( |
|
|
|
(column) => column.title === 'Film List' |
|
|
|
(column) => column.title === 'Film List', |
|
|
|
)!; |
|
|
|
)!; |
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.post( |
|
|
|
.post( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/mm/${filmListColumn.id}/exclude` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/invalid-table-id/${rowId}/mm/${filmListColumn.id}/exclude`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(404); |
|
|
|
.expect(404); |
|
|
@ -2385,7 +2417,7 @@ function tableTest() { |
|
|
|
|
|
|
|
|
|
|
|
const response = await request(context.app) |
|
|
|
const response = await request(context.app) |
|
|
|
.get( |
|
|
|
.get( |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/Film/group/${ratingColumn.id}` |
|
|
|
`/api/v1/db/data/noco/${sakilaProject.id}/Film/group/${ratingColumn.id}`, |
|
|
|
) |
|
|
|
) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.set('xc-auth', context.token) |
|
|
|
.expect(200); |
|
|
|
.expect(200); |
|
|
|