How to use the @webex/test-helper-appid.createUser function in @webex/test-helper-appid

To help you get started, we’ve selected a few @webex/test-helper-appid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webex / react-widgets / test / journeys / lib / test-users.js View on Github external
export function setupTestUserJwt({displayName}) {
  if (!(process.env.WEBEX_APPID_ORGID && process.env.WEBEX_APPID_SECRET)) {
    throw new Error('WEBEX_APPID_ORGID and WEBEX_APPID_SECRET are required to generate guest tokens');
  }

  return createGuestUser({displayName})
    .then(({jwt}) => {
      const guestSpark = new CiscoSpark({
        credentials: {
          federation: true
        }
      });

      return guestSpark.authorization.requestAccessTokenFromJwt({jwt}).then(() =>
        // We don't have a user id for guest users until a record is looked up
        guestSpark.people.get('me').then((p) => {
          const guestUser = Object.assign({}, p);
          // id is hydra from get people, but is expected to be a uuid
          const {id} = deconstructHydraId(p.id);

          guestUser.id = id;
          const email = p.emails[0];

@webex/test-helper-appid

MIT
Latest version published 19 days ago

Package Health Score

82 / 100
Full package analysis

Popular @webex/test-helper-appid functions

Similar packages