()
| 3989 | |
| 3990 | describe(`nested aggregate: count comments per issue (as Collection)`, () => { |
| 3991 | function buildNestedAggregateQuery() { |
| 3992 | return createLiveQueryCollection((q) => |
| 3993 | q.from({ p: projects }).select(({ p }) => ({ |
| 3994 | id: p.id, |
| 3995 | name: p.name, |
| 3996 | issues: q |
| 3997 | .from({ i: issues }) |
| 3998 | .where(({ i }) => eq(i.projectId, p.id)) |
| 3999 | .select(({ i }) => ({ |
| 4000 | id: i.id, |
| 4001 | title: i.title, |
| 4002 | commentCount: q |
| 4003 | .from({ c: comments }) |
| 4004 | .where(({ c }) => eq(c.issueId, i.id)) |
| 4005 | .select(({ c }) => ({ total: count(c.id) })), |
| 4006 | })), |
| 4007 | })), |
| 4008 | ) |
| 4009 | } |
| 4010 | |
| 4011 | it(`each issue gets its own comment count`, async () => { |
| 4012 | const collection = buildNestedAggregateQuery() |
no test coverage detected