import GroupDetailModule from "./groupDetail";

const { module } = angular.mock;

describe("GroupDetail", () => {
  let $httpBackend, $log;
  beforeEach(module(GroupDetailModule));
  beforeEach(module(($stateProvider) => {
    $stateProvider
      .state("main", { url: "", abstract: true });
  }));
  beforeEach(module({ translateFilter: (a) => a }));
  beforeEach(module(($mdAriaProvider) => {
    $mdAriaProvider.disableWarnings();
  }));

  beforeEach(inject(($injector) => {
    $log = $injector.get("$log");
    $log.reset();
  }));
  afterEach(() => {
    $log.assertEmpty();
  });

  beforeEach(inject(($injector) => {
    $httpBackend = $injector.get("$httpBackend");
    $httpBackend.whenGET("/api/stores/").respond([]);
  }));

  afterEach(() => {
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();
  });

  describe("Module", () => {
    it("is named groupDetail", () => {
      expect(GroupDetailModule).to.equal("groupDetail");
    });
  });

  describe("Controller", () => {
    let $componentController;

    beforeEach(inject(($injector) => {
      $componentController = $injector.get("$componentController");
    }));

    it("highlights correct tab", () => {
      let groupData = { id: 667, name: "blarb" };
      let $ctrl = $componentController("groupDetail", {});
      $ctrl.$state.current.name = "group.groupDetail.pickups";
      $ctrl.groupData = groupData;
      $ctrl.$onInit();
      $httpBackend.flush();
      expect($ctrl.currentNavItem).to.equal("pickups");
    });
  });

  describe("Component", () => {
    let $compile, scope;
    beforeEach(inject(($rootScope, $injector) => {
      $compile = $injector.get("$compile");
      scope = $rootScope.$new();
    }));

    it("compiles component", () => {
      $compile("<group-detail></group-detail>")(scope);
      $httpBackend.flush();
    });
  });
});

@@ -128,19 +128,231 @@
 ckend, $
-log
+q, $log;%0A  beforeEach(() =%3E %7B%0A    module(($provide) =%3E %7B%0A      $provide.value(%22Conversation%22, %7B%0A        subscribe() %7B%0A          return $q((resolve) =%3E resolve(%7B unsubscribe() %7B%7D %7D));%0A        %7D%0A      %7D);%0A    %7D);%0A  %7D)
 ;%0A  befo
@@ -681,24 +681,54 @@
 ector) =%3E %7B%0A
+    $q = $injector.get(%22$q%22);%0A
     $log = $
@@ -1457,24 +1457,106 @@
 b%22, () =%3E %7B%0A
+      $httpBackend.expectGET(%22/api/groups/667/conversation/%22).respond(%7B id: 1 %7D);%0A
       let gr

Fix group tests by using mock conversation service