Browse Source

test: api response corrections

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5881/head
Raju Udava 1 year ago
parent
commit
e3bcd63db6
  1. 8
      packages/nocodb/tests/unit/rest/tests/tableRow.test.ts
  2. 131
      packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

8
packages/nocodb/tests/unit/rest/tests/tableRow.test.ts

@ -1425,7 +1425,7 @@ function tableTest() {
const response = await request(context.app) const response = await request(context.app)
.delete(`/api/v1/db/data/noco/${project.id}/${table.id}/${row['Id']}`) .delete(`/api/v1/db/data/noco/${project.id}/${table.id}/${row['Id']}`)
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(400);
const deleteRow = await getRow(context, { project, table, id: row['Id'] }); const deleteRow = await getRow(context, { project, table, id: row['Id'] });
if (!deleteRow) { if (!deleteRow) {
@ -1433,11 +1433,9 @@ function tableTest() {
} }
if ( if (
!(response.body.message[0] as string).includes( !(response.body.msg 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');
} }
}); });

131
packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

@ -1,12 +1,11 @@
import 'mocha'; import 'mocha';
import { isString } from 'util';
import request from 'supertest';
import { UITypes, ViewTypes } 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 Project from '../../../../src/models/Project';
import Model from '../../../../src/models/Model';
import { createTable, getTable } from '../../factory/table'; import { createTable, getTable } from '../../factory/table';
import View from '../../../../src/models/View';
import { ColumnType, UITypes, ViewTypes } from 'nocodb-sdk';
import { createView } from '../../factory/view'; import { createView } from '../../factory/view';
import { import {
createColumn, createColumn,
@ -21,9 +20,11 @@ import {
getOneRow, getOneRow,
getRow, getRow,
} from '../../factory/row'; } from '../../factory/row';
import { expect } from 'chai';
import { isPg } from '../../init/db'; import { isPg } from '../../init/db';
import { isString } from 'util'; import type { ColumnType } from 'nocodb-sdk';
import type View from '../../../../src/models/View';
import type Model from '../../../../src/models/Model';
import type Project from '../../../../src/models/Project';
// Test case list // Test case list
// 1. Get view row list g // 1. Get view row list g
@ -160,7 +161,7 @@ function viewRowTests() {
const testGetViewRowList = async (view: View) => { const testGetViewRowList = async (view: View) => {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -179,7 +180,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -225,7 +226,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -244,7 +245,7 @@ function viewRowTests() {
requiredColumns.map((c: ColumnType) => ({ requiredColumns.map((c: ColumnType) => ({
title: c.title, title: c.title,
uidt: c.uidt, uidt: c.uidt,
})) })),
); );
throw new Error('Wrong columns'); throw new Error('Wrong columns');
} }
@ -271,7 +272,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -287,7 +288,7 @@ function viewRowTests() {
expect( expect(
Object.keys(response.body.find((e) => e.key === 'NC-17').value.list[0]) Object.keys(response.body.find((e) => e.key === 'NC-17').value.list[0])
.sort() .sort()
.join(',') .join(','),
).to.equal('FilmId,Title'); ).to.equal('FilmId,Title');
}; };
@ -297,14 +298,14 @@ function viewRowTests() {
const testDescSortedViewDataList = async (view: View) => { const testDescSortedViewDataList = async (view: View) => {
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' }];
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -332,7 +333,7 @@ function viewRowTests() {
Math.trunc(pageInfo.totalRows / pageInfo.pageSize) * pageInfo.pageSize; Math.trunc(pageInfo.totalRows / pageInfo.pageSize) * pageInfo.pageSize;
const lastPageResponse = await request(context.app) const lastPageResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -375,7 +376,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -390,7 +391,7 @@ function viewRowTests() {
expect(response.body).to.be.have.length(6); expect(response.body).to.be.have.length(6);
expect( expect(
response.body.find((e) => e.key === 'PG').value.list[0].Title response.body.find((e) => e.key === 'PG').value.list[0].Title,
).to.equal('WORST BANGER'); ).to.equal('WORST BANGER');
}; };
@ -400,14 +401,14 @@ function viewRowTests() {
const testAscSortedViewDataList = async (view: View) => { const testAscSortedViewDataList = async (view: View) => {
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' }];
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -435,7 +436,7 @@ function viewRowTests() {
Math.trunc(pageInfo.totalRows / pageInfo.pageSize) * pageInfo.pageSize; Math.trunc(pageInfo.totalRows / pageInfo.pageSize) * pageInfo.pageSize;
const lastPageResponse = await request(context.app) const lastPageResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -478,7 +479,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -493,7 +494,7 @@ function viewRowTests() {
expect(response.body).to.be.have.length(6); expect(response.body).to.be.have.length(6);
expect( expect(
response.body.find((e) => e.key === 'PG').value.list[0].Title response.body.find((e) => e.key === 'PG').value.list[0].Title,
).to.equal('ACADEMY DINOSAUR'); ).to.equal('ACADEMY DINOSAUR');
}; };
@ -502,7 +503,7 @@ function viewRowTests() {
}); });
const testGetViewDataListWithRequiredColumnsAndFilter = async ( const testGetViewDataListWithRequiredColumnsAndFilter = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const rentalTable = await getTable({ const rentalTable = await getTable({
project: sakilaProject, project: sakilaProject,
@ -523,7 +524,7 @@ function viewRowTests() {
}); });
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 = {
@ -549,7 +550,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -560,7 +561,7 @@ function viewRowTests() {
const ascResponse = await request(context.app) const ascResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -579,7 +580,7 @@ function viewRowTests() {
const descResponse = await request(context.app) const descResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${rentalTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -606,7 +607,7 @@ function viewRowTests() {
}); });
const testGetNestedSortedFilteredTableDataListWithLookupColumn = async ( const testGetNestedSortedFilteredTableDataListWithLookupColumn = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const view = await createView(context, { const view = await createView(context, {
title: 'View', title: 'View',
@ -624,11 +625,11 @@ function viewRowTests() {
}); });
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 = {
@ -681,7 +682,7 @@ function viewRowTests() {
const ascResponse = await request(context.app) const ascResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -703,7 +704,7 @@ function viewRowTests() {
} }
const nestedRentalResponse = Object.keys( const nestedRentalResponse = Object.keys(
ascResponse.body.list[0]['Rental List'][0] ascResponse.body.list[0]['Rental List'][0],
); );
if ( if (
@ -719,7 +720,7 @@ function viewRowTests() {
it('Get nested sorted filtered table with nested fields data list with a rollup column in customer table view grid', async () => { it('Get nested sorted filtered table with nested fields data list with a rollup column in customer table view grid', async () => {
await testGetNestedSortedFilteredTableDataListWithLookupColumn( await testGetNestedSortedFilteredTableDataListWithLookupColumn(
ViewTypes.GRID ViewTypes.GRID,
); );
}); });
@ -774,7 +775,7 @@ function viewRowTests() {
await request(context.app) await request(context.app)
.post( .post(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${nonRelatedView.id}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${nonRelatedView.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.send({ .send({
@ -802,7 +803,7 @@ function viewRowTests() {
// todo: Test that all the columns needed to be shown in the view are returned // todo: Test that all the columns needed to be shown in the view are returned
const testFindOneSortedDataWithRequiredColumns = async ( const testFindOneSortedDataWithRequiredColumns = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const view = await createView(context, { const view = await createView(context, {
title: 'View', title: 'View',
@ -810,13 +811,13 @@ function viewRowTests() {
type: viewType, type: viewType,
}); });
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}/views/${view.id}/find-one` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/find-one`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -837,7 +838,7 @@ function viewRowTests() {
response = await request(context.app) response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/find-one` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/find-one`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -870,7 +871,7 @@ function viewRowTests() {
}); });
const testFindOneSortedFilteredNestedFieldsDataWithRollup = async ( const testFindOneSortedFilteredNestedFieldsDataWithRollup = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const rollupColumn = await createRollupColumn(context, { const rollupColumn = await createRollupColumn(context, {
project: sakilaProject, project: sakilaProject,
@ -893,11 +894,11 @@ function viewRowTests() {
}); });
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 = {
@ -950,7 +951,7 @@ function viewRowTests() {
const ascResponse = await request(context.app) const ascResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/find-one` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/find-one`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -995,7 +996,7 @@ function viewRowTests() {
type: viewType, type: viewType,
}); });
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, {
@ -1012,7 +1013,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/groupby` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/groupby`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -1049,7 +1050,7 @@ function viewRowTests() {
}); });
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, {
@ -1066,7 +1067,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/groupby` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/groupby`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.query({ .query({
@ -1105,7 +1106,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/count` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/count`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1136,7 +1137,7 @@ function viewRowTests() {
const listResponse = await request(context.app) const listResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1145,7 +1146,7 @@ function viewRowTests() {
const readResponse = await request(context.app) const readResponse = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/${row['CustomerId']}` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/${row['CustomerId']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1181,7 +1182,7 @@ function viewRowTests() {
const updateResponse = await request(context.app) const updateResponse = await request(context.app)
.patch( .patch(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.send({ .send({
@ -1207,7 +1208,7 @@ function viewRowTests() {
}); });
const testUpdateViewRowWithValidationAndInvalidData = async ( const testUpdateViewRowWithValidationAndInvalidData = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const table = await createTable(context, project); const table = await createTable(context, project);
const emailColumn = await createColumn(context, table, { const emailColumn = await createColumn(context, table, {
@ -1228,7 +1229,7 @@ function viewRowTests() {
await request(context.app) await request(context.app)
.patch( .patch(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.send({ .send({
@ -1253,7 +1254,7 @@ function viewRowTests() {
// todo: Test with form view // todo: Test with form view
const testUpdateViewRowWithValidationAndValidData = async ( const testUpdateViewRowWithValidationAndValidData = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const table = await createTable(context, project); const table = await createTable(context, project);
const emailColumn = await createColumn(context, table, { const emailColumn = await createColumn(context, table, {
@ -1273,7 +1274,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.patch( .patch(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.send({ .send({
@ -1314,7 +1315,7 @@ function viewRowTests() {
await request(context.app) await request(context.app)
.delete( .delete(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1339,7 +1340,7 @@ function viewRowTests() {
}); });
const testDeleteViewRowWithForiegnKeyConstraint = async ( const testDeleteViewRowWithForiegnKeyConstraint = async (
viewType: ViewTypes viewType: ViewTypes,
) => { ) => {
const table = await createTable(context, project); const table = await createTable(context, project);
const relatedTable = await createTable(context, project, { const relatedTable = await createTable(context, project, {
@ -1371,10 +1372,10 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.delete( .delete(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}` `/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(400);
const deleteRow = await getRow(context, { project, table, id: row['Id'] }); const deleteRow = await getRow(context, { project, table, id: row['Id'] });
if (!deleteRow) { if (!deleteRow) {
@ -1382,9 +1383,7 @@ function viewRowTests() {
} }
if ( if (
!(response.body.message[0] as string).includes( !(response.body.msg 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');
} }
@ -1415,7 +1414,7 @@ function viewRowTests() {
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/${row['CustomerId']}/exist` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/${row['CustomerId']}/exist`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1445,7 +1444,7 @@ function viewRowTests() {
}); });
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/999999/exist` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/views/${view.id}/999999/exist`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1475,7 +1474,7 @@ function viewRowTests() {
}); });
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/views/${view.id}/export/csv` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/views/${view.id}/export/csv`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);
@ -1499,7 +1498,7 @@ function viewRowTests() {
}); });
const response = await request(context.app) const response = await request(context.app)
.get( .get(
`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/views/${view.id}/export/excel` `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.title}/views/${view.id}/export/excel`,
) )
.set('xc-auth', context.token) .set('xc-auth', context.token)
.expect(200); .expect(200);

Loading…
Cancel
Save