Add a test for the login flow when there is a teamserver
- just to check it keeps working.
This commit is contained in:
parent
5ff59b0c23
commit
98e694646c
2 changed files with 68 additions and 4 deletions
|
@ -30,6 +30,33 @@ function HttpBackend() {
|
|||
abort: abort,
|
||||
};
|
||||
};
|
||||
|
||||
// very simplistic mapping from the whatwg fetch interface onto the request
|
||||
// interface, so we can use the same mock backend for both.
|
||||
this.fetchFn = function(input, init) {
|
||||
init = init || {};
|
||||
const requestOpts = {
|
||||
uri: input,
|
||||
method: init.method || 'GET',
|
||||
body: init.body,
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
function callback(err, response, body) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
resolve({
|
||||
ok: response.statusCode >= 200 && response.statusCode < 300,
|
||||
json: () => body,
|
||||
});
|
||||
};
|
||||
|
||||
const req = new Request(requestOpts, callback);
|
||||
console.log(`HTTP backend received request: ${req}`);
|
||||
self.requests.push(req);
|
||||
});
|
||||
};
|
||||
}
|
||||
HttpBackend.prototype = {
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue