damian
04/26/2022, 4:51 PMYousaf Nabi (pactflow.io)
damian
04/26/2022, 5:33 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
damian
04/27/2022, 3:47 PMdamian
04/27/2022, 3:48 PMit('returns Welcome to api!', (done) => {
service.helloWorld(provider.mockService.baseUrl).subscribe((res) => {
expect(res).toEqual({
message: 'Welcome to api!'
})
done();
});
})
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Matt (pactflow.io / pact-js / pact-go)
Hey Matt, It’s an observable. This ended up being a mistake on my end. Jest will throw false positives if you don’t handle async tests correctly by adding done() at the end of the subscribe block. After fixing my test they pass 100% of the time now.right, same point basically - it’s an async operation and Jest needs to know to wait for it