Is there a way to do a timeout on the client side (or functions that asynchronous, other than the requests built in in frisby) and make sure that the result of expect's that happen inside of the callback get added to the correct test?
var frisby = require('frisby')
frisby.create('Fetch google.com')
.get('http://google.com')
.after(function() {
setTimeout(function() {
console.log('fetched google.com');
expect(1).toBe(2);
},1)
})
.toss()
This prints out:
Finished in 0.329 seconds
1 test, 0 assertions, 0 failures, 0 skipped
fetched google.com
The scenario I want to test is: I query a REST endpoint and I expect the server behind the REST api to return a response. After returning the response the server does runs followup code (payment) which is supposed to take max X time.
After X time I want to query another REST endpoint and I expect some stuff on the result to show that the system process actually worked.
Kind regards
Ben
Is there a way to do a timeout on the client side (or functions that asynchronous, other than the requests built in in frisby) and make sure that the result of expect's that happen inside of the callback get added to the correct test?
This prints out:
The scenario I want to test is: I query a REST endpoint and I expect the server behind the REST api to return a response. After returning the response the server does runs followup code (payment) which is supposed to take max X time.
After X time I want to query another REST endpoint and I expect some stuff on the result to show that the system process actually worked.
Kind regards
Ben