Bivrost delay adapter
Bivrost adapter enchantment to add request/respone delays for UI tests
yarn add bivrost-delay-adapter
Usage
import DataSource from 'bivrost/data/source';
import axiosAdapter from 'bivrost-axios-adapter';
import delayAdapter from 'bivrost-delay-adapter';
const delayedAxios = delayAdapter(axiosAdapter(), {
request: 1000,
response: 1000
error: 1000
});
const api = bivrostApi({
host: 'localhost',
adapter: delayedAxios()
});
class UsersDataSource extends DataSource {
static api = {
loadAll: api('GET /users')
}
loadUsers(filters) {
return this.invoke('loadAll', filters);
}
}
const usersDataSource = new UsersDataSource();
usersDataSource.loadUsers().then(() => {
console.log('done');
});
Bivrost allows to organize a simple
interface to asyncronous APIs.
Other adapters