Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create functions out of frisby requests, but still allow chaining #375

Open
snowe2010 opened this issue Aug 3, 2017 · 1 comment
Labels

Comments

@snowe2010
Copy link

How can I create a function containing a call to frisby but then return the call before calling done so that I can chain?

ex:


module.exports = function login(state, headers, configurationPage) {
  return frisby.post(configurationPage.baseUrl + '/post',
    {
      blah: bloo
    })
    .then(function (res) {
    let json = res.json;
    headers.request = {};
    headers.request.headers = {};
    headers.request.headers['cookie'] = res.headers._headers['set-cookie'];
    headers.request.headers['Content-Type'] = 'application/json';
    state.user = state.user || {};
    state.user.userId = json.userId;
    state.user.tenantId = json.user.tenantId;
  });
};


describe("new applied user", function () {
  const headers = {};

  beforeAll(function (doneFn) {
    console.log("config page" + configurationPage);
    login(state, headers, configurationPage)
      .then(somethingElse(state, headers, configurationPage))
      .done(doneFn);

  });
});
@snowe2010
Copy link
Author

And also, did you remove retry and waits from the v2 api? Those are pretty necessary functions for our team, as we use an event sourcing engine so we have to deal with eventual consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants