Sawtaytoes
11/24/2018 - 2:27 PM

Original AJAX Caller Function

doScaryLightFlash is an data-fetching function that doesn't utilize dependency injection. Without DNS proxying, we really have no way of unit testing this function or preventing it from actually making the AJAX call.

const doScaryLightFlash = (
  colorSet,
) => (
  fetch(
    lifxEndpoint,
    {
      body: (
        JSON.stringify({
          ...colorSet,
          cycles: getCycles(),
          period: getPeriod(),
        })
      ),
      headers,
      method: 'POST',
    }
  )
)