function createAppServer(port){
server = app.listen(port, () => {
console.log('This is listening')
});
}
How to write unit test cases for the above code in Node Js with jest?
I tried creating a httpserver but it didn't work. Below is the jest code
test('It should return',()=>{
const httpServer = createServer();
httpServer.listen(async() => {
const port = httpServer.address().port;
await createAppServer(port);
});
});