Comments (3)
I was able to mock it using
jest.mock('typeorm-transactional-cls-hooked', () => ({
Transactional: () => jest.fn(),
}));
from typeorm-transactional-cls-hooked.
When I added this it gives this message.
"ConnectionNotFoundError: Connection "default" was not found."
So is seems the mock is not handling mocking out the connection. ?
from typeorm-transactional-cls-hooked.
Same problem here.
I can't figure out how to mock this @transactional decorator.
Here is the used code.
let myService: MyService;
let myRepository: MyRepository;
beforeEach(async () => {
jest.mock('typeorm-transactional-cls-hooked', () => ({
Transactional: () => () => ({}),
BaseRepository: class {},
}));
initializeTransactionalContext();
const module: TestingModule = await Test.createTestingModule({
providers: [
MyService,
MyRepository,
{
provide: getRepositoryToken(MyRepository),
useClass: MyRepositoryFake
}
],
}).compile();
myService = module.get(MyService);
myRepository = module.get(MyRepository);
});
Am I doing something wrong ?
from typeorm-transactional-cls-hooked.
Related Issues (20)
- Transactional not rollback excute Promise.all Propagation.REQUIRED HOT 1
- TypeError: typeorm_transactional_cls_hooked_1.runOnTransactionCommit is not a function HOT 1
- Support the latest version of typeorm (v0.3.x) HOT 16
- Transaction(s) stuck after connection limit reached
- How do i get Transaction to work ? Getting ConnectionNotFound error HOT 5
- can't add new command when connection is in closed state
- Transaction not rolling back as expected
- Transactional doesn't work well with Promise.all HOT 1
- use @Transactional() with @Res of nestjs transaction won't close HOT 1
- QueryRunnerAlreadyReleasedError after runOnTransactionRollback HOT 4
- Feature request: make NAMESPACE_NAME exported
- How to test that method uses Transactional decorator? HOT 1
- How to commit the transaction? HOT 4
- EntityManager is Undefined
- Transactions not working with multiple DBs (connections) HOT 6
- manager property is undefined when using Propagation 'SUPPORTS' HOT 4
- transaction w/o class method decorator HOT 2
- Transactions does not work with multi tenant application HOT 15
- Transaction doesn't work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeorm-transactional-cls-hooked.