Improve tests
This commit is contained in:
parent
5782b20509
commit
975945a23a
|
@ -2278,12 +2278,16 @@ describe.each([
|
||||||
// It also can't work for in-memory searching because the related table name
|
// It also can't work for in-memory searching because the related table name
|
||||||
// isn't available.
|
// isn't available.
|
||||||
!isInMemory &&
|
!isInMemory &&
|
||||||
describe("relations", () => {
|
describe.each([
|
||||||
|
RelationshipType.ONE_TO_MANY,
|
||||||
|
RelationshipType.MANY_TO_ONE,
|
||||||
|
RelationshipType.MANY_TO_MANY,
|
||||||
|
])("relations", relationshipType => {
|
||||||
let productCategoryTable: Table, productCatRows: Row[]
|
let productCategoryTable: Table, productCatRows: Row[]
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const { relatedTable, tableId } = await basicRelationshipTables(
|
const { relatedTable, tableId } = await basicRelationshipTables(
|
||||||
RelationshipType.ONE_TO_MANY
|
relationshipType
|
||||||
)
|
)
|
||||||
tableOrViewId = tableId
|
tableOrViewId = tableId
|
||||||
productCategoryTable = relatedTable
|
productCategoryTable = relatedTable
|
||||||
|
@ -2380,7 +2384,10 @@ describe.each([
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}).toContainExactly([
|
}).toContainExactly([
|
||||||
{ name: "foo", productCat: [{ _id: productCatRows[0]._id }] },
|
{
|
||||||
|
name: "foo",
|
||||||
|
productCat: [{ _id: productCatRows[0]._id }],
|
||||||
|
},
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -2480,7 +2487,10 @@ describe.each([
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}).toContainExactly([
|
}).toContainExactly([
|
||||||
{ name: "foo", productCat: [{ _id: productCatRows[0]._id }] },
|
{
|
||||||
|
name: "foo",
|
||||||
|
productCat: [{ _id: productCatRows[0]._id }],
|
||||||
|
},
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -2504,8 +2514,14 @@ describe.each([
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}).toContainExactly([
|
}).toContainExactly([
|
||||||
{ name: "foo", productCat: [{ _id: productCatRows[0]._id }] },
|
{
|
||||||
{ name: "bar", productCat: [{ _id: productCatRows[1]._id }] },
|
name: "foo",
|
||||||
|
productCat: [{ _id: productCatRows[0]._id }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bar",
|
||||||
|
productCat: [{ _id: productCatRows[1]._id }],
|
||||||
|
},
|
||||||
{ name: "baz", productCat: undefined },
|
{ name: "baz", productCat: undefined },
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue