Need some clarification
See original GitHub issueHi @alonronin,
Mockingoose looks great! Thanks for creating this project.
I am having trouble using Mockingoose + Jest in my project, but I am sure its due to my lack of knowledge and I am hoping you can provide some clarification.
I am trying to test a wrapper function but I keep getting a timeout in jest.
// userCreate.js
import { User } from '../models'
const createUser = user => {
const doc = new User(user)
return doc.save();
}
export default createUser;
// userCreate.test.js
import mockingoose from 'mockingoose';
import createUser from './createUser';
describe('test create user api', () => {
it('should create user', async () => {
mockingoose.User.toReturn({ _id: '507f191e810c19729de860ea' }, 'save');
return createUser({ first_name: 'Calvin', last_name: 'Chan' })
.then(result => {
console.log(result);
expect(true).toBe(true);
});
});
});
// console
$> jest
FAIL src/users/createUser.test.js (7.675s)
● test create user api › should create user
Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
I am expecting the test to pass but receiving a timeout instead. It looks like the promise is never resolved in createUser.js. Any guidance will be greatly appreciated.
Thanks in advance for your help!
Calvin
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
I need some clarification | English examples in context - Ludwig
High quality example sentences with “I need some clarification” in context from reliable sources - Ludwig is the linguistic search engine that helps...
Read more >I need some clarification on the matter. or I need ... - TextRanch
You want me to complete the job, I need some clarification. Given that the scope of the 'health check' exercise is not yet...
Read more >How to Ask for Clarification - VOA Learning English
After you express your lack of understanding, the next step is to ask the person to clarify what they have said. Here are...
Read more >I need some clarification on some points ! : r/grammar - Reddit
Hey guys, I have confusions about several points : is it correct to say : ''I wish I could have'' to express my...
Read more >20 Email Expressions to Ask for Clarification - Tannia Suarez
Could you give me some more details about...? Correct me if I'm wrong… As no doubt you are aware… Let me know if...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i have the same problem too and i find that using mockingoose@2.4.0 works fine but newer releases result in the timeout
@calvintychan can you share with me a sample project so I can test it?