function generateFakeConfig(
  serviceClass,
  fakeKey,
  fakeUser,
  fakeauthorizedOrigins,
) {
  if (
    !serviceClass ||
    !serviceClass.prototype ||
    !(serviceClass.prototype instanceof BaseService)
  ) {
    throw new TypeError(
      'Invalid serviceClass: Must be an instance of BaseService.',
    )
  }
  if (!fakeKey || typeof fakeKey !== 'string') {
    throw new TypeError('Invalid fakeKey: Must be a String.')
  }
  if (!fakeauthorizedOrigins || !Array.isArray(fakeauthorizedOrigins)) {
    throw new TypeError('Invalid fakeauthorizedOrigins: Must be an array.')
  }

  if (!serviceClass.auth) {
    throw new Error(`Missing auth for ${serviceClass.name}.`)
  }
  if (!serviceClass.auth.passKey) {
    throw new Error(`Missing auth.passKey for ${serviceClass.name}.`)
  }
  // Extract the passKey property from auth, or use a default if not present
  const passKeyProperty = serviceClass.auth.passKey
  let passUserProperty = 'placeholder'
  if (fakeUser) {
    if (typeof fakeKey !== 'string') {
      throw new TypeError('Invalid fakeUser: Must be a String.')
    }
    if (!serviceClass.auth.userKey) {
      throw new Error(`Missing auth.userKey for ${serviceClass.name}.`)
    }
    passUserProperty = serviceClass.auth.userKey
  }

  // Build and return the configuration object with the fake key
  return {
    public: {
      services: {
        [serviceClass.auth.serviceKey]: {
          authorizedOrigins: fakeauthorizedOrigins,
        },
      },
    },
    private: {
      [passKeyProperty]: fakeKey,
      [passUserProperty]: fakeUser,
    },
  }
}
Generates a configuration object with a fake key based on the provided class.
For use in auth tests where a config with a test key is required.

@param {BaseService} serviceClass - The class to generate configuration for.
@param {string} fakeKey - The fake key to be used in the configuration.
@param {string} fakeUser - Optional, The fake user to be used in the configuration.
@param {string} fakeauthorizedOrigins - authorizedOrigins to add to config.
@returns {object} - The configuration object.
@throws {TypeError} - Throws an error if the input is not a class.