(em: MikroORM['em'])
| 229 | } |
| 230 | |
| 231 | async function getCollections(em: MikroORM['em']): Promise<Collection<any>[]> { |
| 232 | const authors = await em.find(Author, {}, { first: 3, orderBy: { id: QueryOrder.ASC } }); |
| 233 | for (const author of authors) { |
| 234 | expect(author.books.isInitialized()).toBe(false); |
| 235 | expect(author.friends.isInitialized()).toBe(false); |
| 236 | } |
| 237 | const publishers = await em.find(Publisher, {}, { first: 2, orderBy: { id: QueryOrder.ASC } }); |
| 238 | for (const publisher of publishers) { |
| 239 | expect(publisher.books.isInitialized()).toBe(false); |
| 240 | } |
| 241 | const chats = await em.find(Chat, {}, { first: 2 }); |
| 242 | return [ |
| 243 | ...authors.map(author => author.books), |
| 244 | ...publishers.map(publisher => publisher.books), |
| 245 | ...authors.map(author => author.buddies), |
| 246 | // ...authors.map(author => author.friends), |
| 247 | ...authors.map(author => author.ownedChats), |
| 248 | ...chats.map(chat => chat.messages), |
| 249 | ]; |
| 250 | } |
| 251 | |
| 252 | describe('Dataloader', () => { |
| 253 | let orm: MikroORM; |
no test coverage detected