{"size": 1251, "ext": "js", "max_stars_repo_path": "public/test/custom-services.spec.js", "max_stars_repo_name": "yuribett/letseat", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/test/custom-services.spec.js", "max_issues_repo_name": "yuribett/letseat", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/test/custom-services.spec.js", "max_forks_repo_name": "yuribett/letseat", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.7857142857, "max_line_length": 101, "alphanum_fraction": 0.653077538}
describe('CustomServices', function () {

  beforeEach(module('letseat'));
  beforeEach(module('customServices'));
  
  let $httpBackend, userResource, restaurantResource, pollResource;

  beforeEach(inject(function (_$httpBackend_, _userResource_, _restaurantResource_, _pollResource_) {
    $httpBackend = _$httpBackend_;
    userResource = _userResource_;
    restaurantResource = _restaurantResource_;
    pollResource = _pollResource_;
  }));

  afterEach(function() {
     $httpBackend.verifyNoOutstandingExpectation();
     $httpBackend.verifyNoOutstandingRequest();
   });

  it('should resquest a list of users', function () {
    userResource.query();
    $httpBackend.when('GET', '/api/user')
      .respond(200, [{ _id: 1 , name: 'Tim Cook' }]);
    $httpBackend.flush();
    
  });

  it('should resquest a list of restaurants', function () {
    restaurantResource.query();
    $httpBackend.when('GET', '/api/restaurant')
      .respond(200, [{ _id: 1 , name: 'Meet lovers' }]);
    $httpBackend.flush();
  });

  it('should post a vote', function () {
    pollResource.save();
    $httpBackend.when('POST', '/api/poll',  { user: 1 , restaurant: 1 })
      .respond(201, { user: 1 , restaurant: 1 });
    $httpBackend.flush();
  });

});