I'm running integration tests similar to this, if I try to check database contents the query do not find inserted rows. Does the EntityManager use diffrent connections ? or I need to "flush" in some ways ( I do no know how ) ? The manager.save works with success, I see in typeORM logs the insert without errors and generated id of entities are filled.
test('should be retived ', async () => {
const manager = getManager();
await manager.save(item_1);
const result = await manager.createQueryBuilder()
.select()
.from(EntityTypeX, "x")
.getMany();
expect(result).toHaveLength(1) //This return zero
});
..
beforeAll( async () => {
return opneDBCconnection();
});
beforeEach( async () => {
// Clenaup
getManager().createQueryBuilder()
.delete()
.from(Sms)
.execute();
});
Aucun commentaire:
Enregistrer un commentaire