connectTo function

Future<TestClient> connectTo (
  1. Angel app,
  2. {Map initialSession,
  3. bool autoDecodeGzip: true,
  4. bool useZone: false}
)

Shorthand for bootstrapping a TestClient.

Implementation

Future<TestClient> connectTo(Angel app,
    {Map initialSession,
    bool autoDecodeGzip: true,
    bool useZone: false}) async {
  if (!app.isProduction) app.configuration.putIfAbsent('testMode', () => true);

  for (var plugin in app.startupHooks) await plugin(app);
  return new TestClient(app,
      autoDecodeGzip: autoDecodeGzip != false, useZone: useZone)
    ..session.addAll(initialSession ?? {});
}