|
|
@ -6,7 +6,13 @@ import { expect } from 'chai'; |
|
|
|
import init from '../../init'; |
|
|
|
import init from '../../init'; |
|
|
|
import { createProject, createSakilaProject } from '../../factory/base'; |
|
|
|
import { createProject, createSakilaProject } from '../../factory/base'; |
|
|
|
import { createColumn, createQrCodeColumn } from '../../factory/column'; |
|
|
|
import { createColumn, createQrCodeColumn } from '../../factory/column'; |
|
|
|
import { getTable } from '../../factory/table'; |
|
|
|
import { |
|
|
|
|
|
|
|
createTable, |
|
|
|
|
|
|
|
getColumnsByAPI, |
|
|
|
|
|
|
|
getTable, |
|
|
|
|
|
|
|
getTableByAPI, |
|
|
|
|
|
|
|
} from '../../factory/table'; |
|
|
|
|
|
|
|
import { createBulkRows, listRow, rowMixedValue } from '../../factory/row'; |
|
|
|
import type Model from '../../../../src/models/Model'; |
|
|
|
import type Model from '../../../../src/models/Model'; |
|
|
|
import type Base from '~/models/Base'; |
|
|
|
import type Base from '~/models/Base'; |
|
|
|
import type Column from '../../../../src/models/Column'; |
|
|
|
import type Column from '../../../../src/models/Column'; |
|
|
@ -27,34 +33,34 @@ function columnTypeSpecificTests() { |
|
|
|
const qrValueReferenceColumnTitle = 'Qr Value Column'; |
|
|
|
const qrValueReferenceColumnTitle = 'Qr Value Column'; |
|
|
|
const qrCodeReferenceColumnTitle = 'Qr Code Column'; |
|
|
|
const qrCodeReferenceColumnTitle = 'Qr Code Column'; |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(async function () { |
|
|
|
describe('Qr Code Column', () => { |
|
|
|
console.time('#### columnTypeSpecificTests'); |
|
|
|
beforeEach(async function () { |
|
|
|
context = await init(true); |
|
|
|
console.time('#### columnTypeSpecificTests'); |
|
|
|
|
|
|
|
context = await init(true); |
|
|
|
|
|
|
|
|
|
|
|
sakilaProject = await createSakilaProject(context); |
|
|
|
sakilaProject = await createSakilaProject(context); |
|
|
|
base = await createProject(context); |
|
|
|
base = await createProject(context); |
|
|
|
|
|
|
|
|
|
|
|
customerTable = await getTable({ |
|
|
|
customerTable = await getTable({ |
|
|
|
base: sakilaProject, |
|
|
|
base: sakilaProject, |
|
|
|
name: 'customer', |
|
|
|
name: 'customer', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
qrValueReferenceColumn = await createColumn(context, customerTable, { |
|
|
|
qrValueReferenceColumn = await createColumn(context, customerTable, { |
|
|
|
title: qrValueReferenceColumnTitle, |
|
|
|
title: qrValueReferenceColumnTitle, |
|
|
|
uidt: UITypes.SingleLineText, |
|
|
|
uidt: UITypes.SingleLineText, |
|
|
|
table_name: customerTable.table_name, |
|
|
|
table_name: customerTable.table_name, |
|
|
|
column_name: qrValueReferenceColumnTitle, |
|
|
|
column_name: qrValueReferenceColumnTitle, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await createQrCodeColumn(context, { |
|
|
|
await createQrCodeColumn(context, { |
|
|
|
title: qrCodeReferenceColumnTitle, |
|
|
|
title: qrCodeReferenceColumnTitle, |
|
|
|
table: customerTable, |
|
|
|
table: customerTable, |
|
|
|
referencedQrValueTableColumnTitle: qrValueReferenceColumnTitle, |
|
|
|
referencedQrValueTableColumnTitle: qrValueReferenceColumnTitle, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('#### columnTypeSpecificTests'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.timeEnd('#### columnTypeSpecificTests'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('Qr Code Column', () => { |
|
|
|
|
|
|
|
it('delivers the same cell values as the referenced column', async () => { |
|
|
|
it('delivers the same cell values as the referenced column', async () => { |
|
|
|
const resp = await request(context.app) |
|
|
|
const resp = await request(context.app) |
|
|
|
.get(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}`) |
|
|
|
.get(`/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}`) |
|
|
@ -93,6 +99,69 @@ function columnTypeSpecificTests() { |
|
|
|
).to.eq(false); |
|
|
|
).to.eq(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Created-at, Last-modified-at field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let table: Model; |
|
|
|
|
|
|
|
let columns: any[]; |
|
|
|
|
|
|
|
let unfilteredRecords: any[] = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe.skip('CreatedAt, LastModifiedAt Field', () => { |
|
|
|
|
|
|
|
beforeEach(async function () { |
|
|
|
|
|
|
|
context = await init(); |
|
|
|
|
|
|
|
base = await createProject(context); |
|
|
|
|
|
|
|
table = await createTable(context, base, { |
|
|
|
|
|
|
|
table_name: 'dateBased', |
|
|
|
|
|
|
|
title: 'dateBased', |
|
|
|
|
|
|
|
columns: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
column_name: 'Id', |
|
|
|
|
|
|
|
title: 'Id', |
|
|
|
|
|
|
|
uidt: UITypes.ID, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
column_name: 'Date', |
|
|
|
|
|
|
|
title: 'Date', |
|
|
|
|
|
|
|
uidt: UITypes.Date, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// column_name: 'CreatedAt',
|
|
|
|
|
|
|
|
// title: 'CreatedAt',
|
|
|
|
|
|
|
|
// uidt: UITypes.CreatedTime,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// column_name: 'LastModifiedAt',
|
|
|
|
|
|
|
|
// title: 'LastModifiedAt',
|
|
|
|
|
|
|
|
// uidt: UITypes.LastModifiedTime,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
columns = await table.getColumns(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rowAttributes = []; |
|
|
|
|
|
|
|
for (let i = 0; i < 100; i++) { |
|
|
|
|
|
|
|
const row = { |
|
|
|
|
|
|
|
Date: rowMixedValue(columns[1], i), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
rowAttributes.push(row); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await createBulkRows(context, { |
|
|
|
|
|
|
|
base, |
|
|
|
|
|
|
|
table, |
|
|
|
|
|
|
|
values: rowAttributes, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
unfilteredRecords = await listRow({ base, table }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify length of unfiltered records to be 800
|
|
|
|
|
|
|
|
expect(unfilteredRecords.length).to.equal(100); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should filter records by created-at field', async () => { |
|
|
|
|
|
|
|
console.log('test'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default function () { |
|
|
|
export default function () { |
|
|
|