Fix tests
This commit is contained in:
parent
576ebc997e
commit
39511a4e83
|
@ -70,14 +70,10 @@ describe.each([
|
||||||
let rows: Row[]
|
let rows: Row[]
|
||||||
|
|
||||||
async function basicRelationshipTables(type: RelationshipType) {
|
async function basicRelationshipTables(type: RelationshipType) {
|
||||||
const relatedTable = await createTable(
|
const relatedTable = await createTable({
|
||||||
{
|
|
||||||
name: { name: "name", type: FieldType.STRING },
|
name: { name: "name", type: FieldType.STRING },
|
||||||
},
|
})
|
||||||
generator.guid().substring(0, 10)
|
const tableId = await createTable({
|
||||||
)
|
|
||||||
const tableId = await createTable(
|
|
||||||
{
|
|
||||||
name: { name: "name", type: FieldType.STRING },
|
name: { name: "name", type: FieldType.STRING },
|
||||||
//@ts-ignore - API accepts this structure, will build out rest of definition
|
//@ts-ignore - API accepts this structure, will build out rest of definition
|
||||||
productCat: {
|
productCat: {
|
||||||
|
@ -90,9 +86,7 @@ describe.each([
|
||||||
type: "array",
|
type: "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
generator.guid().substring(0, 10)
|
|
||||||
)
|
|
||||||
return {
|
return {
|
||||||
relatedTable: await config.api.table.get(relatedTable),
|
relatedTable: await config.api.table.get(relatedTable),
|
||||||
tableId,
|
tableId,
|
||||||
|
@ -138,9 +132,9 @@ describe.each([
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function createTable(schema: TableSchema, name?: string) {
|
async function createTable(schema: TableSchema) {
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
tableForDatasource(datasource, { schema, name })
|
tableForDatasource(datasource, { schema })
|
||||||
)
|
)
|
||||||
return table._id!
|
return table._id!
|
||||||
}
|
}
|
||||||
|
@ -157,8 +151,8 @@ describe.each([
|
||||||
["table", createTable],
|
["table", createTable],
|
||||||
[
|
[
|
||||||
"view",
|
"view",
|
||||||
async (schema: TableSchema, name?: string) => {
|
async (schema: TableSchema) => {
|
||||||
const tableId = await createTable(schema, name)
|
const tableId = await createTable(schema)
|
||||||
const view = await config.api.viewV2.create({
|
const view = await config.api.viewV2.create({
|
||||||
tableId: tableId,
|
tableId: tableId,
|
||||||
name: generator.guid(),
|
name: generator.guid(),
|
||||||
|
@ -2042,8 +2036,7 @@ describe.each([
|
||||||
isSql &&
|
isSql &&
|
||||||
describe("related formulas", () => {
|
describe("related formulas", () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const arrayTable = await createTable(
|
const arrayTable = await createTable({
|
||||||
{
|
|
||||||
name: { name: "name", type: FieldType.STRING },
|
name: { name: "name", type: FieldType.STRING },
|
||||||
array: {
|
array: {
|
||||||
name: "array",
|
name: "array",
|
||||||
|
@ -2053,11 +2046,8 @@ describe.each([
|
||||||
inclusion: ["option 1", "option 2"],
|
inclusion: ["option 1", "option 2"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
"array"
|
tableOrViewId = await createTableOrView({
|
||||||
)
|
|
||||||
tableOrViewId = await createTableOrView(
|
|
||||||
{
|
|
||||||
relationship: {
|
relationship: {
|
||||||
type: FieldType.LINK,
|
type: FieldType.LINK,
|
||||||
relationshipType: RelationshipType.MANY_TO_ONE,
|
relationshipType: RelationshipType.MANY_TO_ONE,
|
||||||
|
@ -2075,9 +2065,7 @@ describe.each([
|
||||||
`let array = [];$("relationship").forEach(rel => array = array.concat(rel.array));return array.sort().join(",")`
|
`let array = [];$("relationship").forEach(rel => array = array.concat(rel.array));return array.sort().join(",")`
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
"main"
|
|
||||||
)
|
|
||||||
const arrayRows = await Promise.all([
|
const arrayRows = await Promise.all([
|
||||||
config.api.row.save(arrayTable, {
|
config.api.row.save(arrayTable, {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
|
@ -2378,12 +2366,9 @@ describe.each([
|
||||||
let relatedTable: string, relatedRows: Row[]
|
let relatedTable: string, relatedRows: Row[]
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
relatedTable = await createTable(
|
relatedTable = await createTable({
|
||||||
{
|
|
||||||
name: { name: "name", type: FieldType.STRING },
|
name: { name: "name", type: FieldType.STRING },
|
||||||
},
|
})
|
||||||
"productCategory"
|
|
||||||
)
|
|
||||||
tableOrViewId = await createTableOrView({
|
tableOrViewId = await createTableOrView({
|
||||||
name: { name: "name", type: FieldType.STRING },
|
name: { name: "name", type: FieldType.STRING },
|
||||||
related1: {
|
related1: {
|
||||||
|
|
Loading…
Reference in New Issue