function validate(runtimeCachingOptions, convertedOptions) {
  expect(convertedOptions).to.have.lengthOf(runtimeCachingOptions.length);

  const globalScope = {
    workbox_cacheable_response_CacheableResponsePlugin: sinon.spy(),
    workbox_expiration_ExpirationPlugin: sinon.spy(),
    workbox_background_sync_BackgroundSyncPlugin: sinon.spy(),
    workbox_broadcast_update_BroadcastUpdatePlugin: sinon.spy(),
    workbox_precaching_PrecacheFallbackPlugin: sinon.spy(),
    workbox_range_requests_RangeRequestsPlugin: sinon.spy(),
    workbox_routing_registerRoute: sinon.spy(),
    workbox_strategies_CacheFirst: sinon.spy(),
    workbox_strategies_CacheOnly: sinon.spy(),
    workbox_strategies_NetworkFirst: sinon.spy(),
    workbox_strategies_NetworkOnly: sinon.spy(),
    workbox_strategies_StaleWhileRevalidate: sinon.spy(),
  };

  // Make it easier to find the right spy given a handler name.
  const handlerMapping = {
    CacheFirst: globalScope.workbox_strategies_CacheFirst,
    CacheOnly: globalScope.workbox_strategies_CacheOnly,
    NetworkFirst: globalScope.workbox_strategies_NetworkFirst,
    NetworkOnly: globalScope.workbox_strategies_NetworkOnly,
    StaleWhileRevalidate: globalScope.workbox_strategies_StaleWhileRevalidate,
  };

  const script = new vm.Script(convertedOptions.join('\n'));
  script.runInNewContext(globalScope);
  runtimeCachingOptions.forEach((runtimeCachingOption, i) => {
    const registerRouteCall =
      globalScope.workbox_routing_registerRoute.getCall(i);
    expect(registerRouteCall.args[0]).to.eql(runtimeCachingOption.urlPattern);

    if (runtimeCachingOption.method) {
      expect(registerRouteCall.args[2]).to.eql(runtimeCachingOption.method);
    } else {
      expect(registerRouteCall.args[2]).to.eql('GET');
    }

    if (typeof runtimeCachingOption.handler === 'function') {
      // We can't make assumptions about what custom function handlers will do.
      return;
    }

    // This validation assumes that there's only going to be one call to each
    // named strategy per test.
    const strategiesCall =
      handlerMapping[runtimeCachingOption.handler].firstCall;
    const strategiesOptions = strategiesCall.args[0];

    if (runtimeCachingOption.options) {
      const options = runtimeCachingOption.options;
      if (options.networkTimeoutSeconds) {
        expect(options.networkTimeoutSeconds).to.eql(
          strategiesOptions.networkTimeoutSeconds,
        );
      }

      if (options.cacheName) {
        expect(options.cacheName).to.eql(strategiesOptions.cacheName);
      }

      if (options.fetchOptions) {
        expect(options.fetchOptions).to.deep.eql(
          strategiesOptions.fetchOptions,
        );
      }

      if (options.matchOptions) {
        expect(options.matchOptions).to.deep.eql(
          strategiesOptions.matchOptions,
        );
      }

      if (Object.keys(options.expiration).length > 0) {
        expect(
          globalScope.workbox_expiration_ExpirationPlugin.calledWith(
            options.expiration,
          ),
        ).to.be.true;
      }

      if (options.cacheableResponse) {
        expect(
          globalScope.workbox_cacheable_response_CacheableResponsePlugin.calledWith(
            options.cacheableResponse,
          ),
        ).to.be.true;
      }

      if (options.precacheFallback) {
        expect(
          globalScope.workbox_precaching_PrecacheFallbackPlugin.calledWith(
            options.precacheFallback,
          ),
        ).to.be.true;
      }

      if (options.rangeRequests) {
        expect(
          globalScope.workbox_range_requests_RangeRequestsPlugin.calledWith(),
        ).to.be.true;
      }

      if (options.backgroundSync) {
        if ('options' in options.backgroundSync) {
          expect(
            globalScope.workbox_background_sync_BackgroundSyncPlugin.calledWith(
              options.backgroundSync.name,
              options.backgroundSync.options,
            ),
          ).to.be.true;
        } else {
          expect(
            globalScope.workbox_background_sync_BackgroundSyncPlugin.calledWith(
              options.backgroundSync.name,
            ),
          ).to.be.true;
        }
      }

      if (options.broadcastUpdate) {
        if ('options' in options.broadcastUpdate) {
          const expectedOptions = Object.assign(
            {channelName: options.broadcastUpdate.channelName},
            options.broadcastUpdate.options,
          );
          expect(
            globalScope.workbox_broadcast_update_BroadcastUpdatePlugin.calledWith(
              expectedOptions,
            ),
          ).to.be.true;
        } else {
          expect(
            globalScope.workbox_broadcast_update_BroadcastUpdatePlugin.calledWith(
              {channelName: options.broadcastUpdate.channelName},
            ),
          ).to.be.true;
        }
      }
    }
  });
}
Validates the method calls for a given set of runtimeCachingOptions.

@private
@param {Array<Object>} runtimeCachingOptions
@param {Array<string>} convertedOptions