* Recursively converts a live query collection (or child Collection) into a * plain sorted array, turning any nested child Collections into nested arrays. * This lets tests compare the full hierarchical result as a single literal.
(collectionOrArray: any, sortKey = `id`)
| 133 | * This lets tests compare the full hierarchical result as a single literal. |
| 134 | */ |
| 135 | function toTree(collectionOrArray: any, sortKey = `id`): Array<any> { |
| 136 | const rows = ( |
| 137 | Array.isArray(collectionOrArray) |
| 138 | ? [...collectionOrArray] |
| 139 | : [...collectionOrArray.toArray] |
| 140 | ).sort((a: any, b: any) => a[sortKey] - b[sortKey]) |
| 141 | return rows.map((row: any) => stripVirtualPropsDeep(row)) |
| 142 | } |
| 143 | |
| 144 | describe(`includes subqueries`, () => { |
| 145 | let projects: ReturnType<typeof createProjectsCollection> |
no test coverage detected