-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Not sure if this is supposed to be a capability of this library or not, but when I add the following unit test to this library to test whether it works:
describe('parent has children', async () => {
it('Can find parent with children', async () => {
const repository = AbstractPolymorphicRepository.createRepository(
connection,
AdvertRepository,
);
const userRepository = connection.getRepository(UserEntity);
const user = await userRepository.save(new UserEntity());
await repository.save([
repository.create({
owner: user,
}),
repository.create({
owner: user,
}),
]);
const result = await userRepository.find();
result.forEach((res) => {
expect(res).toBeInstanceOf(UserEntity);
expect(res.adverts).toBeInstanceOf(Array);
expect(res.adverts.length).toBe(2);
});
});
});
users returned from userRepository.find() always have res.adverts
=== undefined
. I would've expected this field to be populated when retrieving from the repository.
I also added eager: true
to the adverts
field of UserEntity
but that didn't make any difference.
Am I doing something wrong?
solanamonk
Metadata
Metadata
Assignees
Labels
No labels