<commit_before>describe('MerchantMenuController', function () {
  var $scope;
  var $rootScope;
  var createController;
  var $httpBackend;
  var vendor;
  var menu;

  beforeEach(module('zibzoo'));
  beforeEach(inject(function ($injector) {

    $rootScope = $injector.get('$rootScope');
    $httpBackend = $injector.get('$httpBackend');
    vendor = $injector.get('vendor');
    menu = $injector.get('menu');

    $scope = $rootScope.$new();

    var $controller = $injector.get('$controller');

    createController = function () {
      return $controller('MerchantMenuController', {
        $scope: $scope,
        vendor: vendor,
        menu: menu
      });
    };

    var fakeData = [{}, {}, {}, {}];
    $httpBackend.whenGET('/api/vendor').respond(fakeData);
    $httpBackend.whenGET('app/landing/landing.html').respond(fakeData);
    $httpBackend.whenPOST('api/vendor/menuItems').respond(201);
    $httpBackend.whenDELETE('api/vendor/menuItems').respond(204);

    createController();
    $httpBackend.flush();
  }));

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

  describe('$scope.menu', function () {
    it('should be a property on the $scope', function () {
      expect($scope.menu).toBeDefined();
    });
    it('should be assigned to the menu factory', function () {
      expect($scope.menu).toBe(menu);
    });
  });

  describe('$scope.menuItem', function () {
    it('should be a property on the$scope object', function () {
      expect($scope.menuItem).toBeDefined();
    });
    it('should have a blank Menu Item saved to it on Page load',
      function () {
        var menuItem = {
          name: '',
          description: '',
          price: '',
          inStock: true,
          calories: 0,
          isGlutenFree: false,
          isVegan: false,
          isDairyFree: false,
          isVegetarian: false
        };
        expect($scope.menuItem).toEqual(menuItem);
      });
  });

  describe('$scope.clearItem', function () {
    it('should be a function on the $scope object', function () {
      expect(typeof $scope.clearItem).toEqual('function');
    });
    it('should reassign $scope.menuItem to a blank menuItem when it is invoked',
      function () {
        var menuItem = {
          name: '',
          description: '',
          price: '',
          inStock: true,
          calories: 0,
          isGlutenFree: false,
          isVegan: false,
          isDairyFree: false,
          isVegetarian: false
        };

        $scope.menuItem.name = 'pasta';
        $scope.menuItem.description = 'this is a delicious pasta';
        $scope.menuItem.price = 300;
        $scope.clearItem();
        expect($scope.menuItem).toEqual(menuItem);
      });
    it('should be called by $scope.saveMenuItem', function () {
      spyOn($scope, 'clearItem');
      $scope.saveMenuItem({ name: 'hello' });
      $httpBackend.flush();
      expect($scope.clearItem).toHaveBeenCalled();
    });
  });

  describe('$scope.deleteMenuItem', function () {
    it('should be a function on the scope object', function () {
      expect(typeof $scope.deleteMenuItem).toBe('function');
    });
    it('should make a delete request by calling $scope.menu.deleteMenuItem', function () {
      spyOn($scope.menu, 'deleteMenuItem').and.callThrough();
      $scope.deleteMenuItem(5);
      $httpBackend.flush();
      expect($scope.deleteStatus).toEqual(204);
      expect($scope.menu.deleteMenuItem).toHaveBeenCalled();
    });
    it('should throw an error when an error code is recieved', function () {
      $httpBackend.expectDELETE('api/vendor/menuItems').respond(500);
      $scope.deleteMenuItem(88);
      $httpBackend.flush();
      expect($scope.deleteStatus).toEqual(500);
    });
  });

  describe('$scope.saveMenuItem', function () {
    it('should be a function on the scope object', function () {
      expect(typeof $scope.saveMenuItem).toBe('function');
    });
    it('should make a post request calling $scope.menu.saveMenutItem', function () {
      spyOn($scope.menu, 'saveMenuItem').and.callThrough();
      $scope.saveMenuItem({ name: 'fajita' });
      $httpBackend.flush();
      expect($scope.menu.saveMenuItem).toHaveBeenCalled();
      expect($scope.saveStatus).toEqual(201);
    });
    it('should throw an error when an error code is recieved', function () {
      $httpBackend.expectPOST('api/vendor/menuItems').respond(500);
      $scope.saveMenuItem({ name: '<NAME>' });
      $httpBackend.flush();
      expect($scope.saveStatus).toEqual(500);
    });
  });
  describe('$scope.getMenu', function () {
    it('should be a function on th scope object', function () {
      expect(typeof $scope.getMenu).toBe('function');
    });
    it('should make a get request by calling vendor.getVendor', function () {
      spyOn(vendor, 'getVendor').and.callThrough();
      var data = {
        menuItems: [{}, {}, {}, {}]
      };
      $httpBackend.expectGET('/api/vendor').respond(data);
      $scope.getMenu(4567890);
      $httpBackend.flush();
      expect($scope.vendor.getVendor).toHaveBeenCalled();
      expect($scope.menu.items).toEqual(data.menuItems);
    });
  });
});
<commit_msg>[fix] fix merge conflict<commit_after>describe('MerchantMenuController', function () {
  var $scope;
  var $rootScope;
  var createController;
  var $httpBackend;
  var vendor;
  var menu;

  beforeEach(module('zibzoo'));
  beforeEach(inject(function ($injector) {

    $rootScope = $injector.get('$rootScope');
    $httpBackend = $injector.get('$httpBackend');
    vendor = $injector.get('vendor');
    menu = $injector.get('menu');

    $scope = $rootScope.$new();

    var $controller = $injector.get('$controller');

    createController = function () {
      return $controller('MerchantMenuController', {
        $scope: $scope,
        vendor: vendor,
        menu: menu
      });
    };

    var fakeData = [{}, {}, {}, {}];
    $httpBackend.whenGET('/api/vendor').respond(fakeData);
    $httpBackend.whenGET('app/landing/landing.html').respond(fakeData);
    $httpBackend.whenPOST('api/vendor/menuItems').respond(201);
    $httpBackend.whenDELETE('api/vendor/menuItems').respond(204);

    createController();
    $httpBackend.flush();
  }));

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

  describe('$scope.menu', function () {
    it('should be a property on the $scope', function () {
      expect($scope.menu).toBeDefined();
    });
    it('should be assigned to the menu factory', function () {
      expect($scope.menu).toBe(menu);
    });
  });

  describe('$scope.menuItem', function () {
    it('should be a property on the$scope object', function () {
      expect($scope.menuItem).toBeDefined();
    });
    it('should have a blank Menu Item saved to it on Page load',
      function () {
        var menuItem = {
          name: '',
          description: '',
          price: '',
          inStock: true,
          calories: 0,
          isGlutenFree: false,
          isVegan: false,
          isDairyFree: false,
          isVegetarian: false
        };
        expect($scope.menuItem).toEqual(menuItem);
      });
  });

  describe('$scope.clearItem', function () {
    it('should be a function on the $scope object', function () {
      expect(typeof $scope.clearItem).toEqual('function');
    });
    it('should reassign $scope.menuItem to a blank menuItem when it is invoked',
      function () {
        var menuItem = {
          name: '',
          description: '',
          price: '',
          inStock: true,
          calories: 0,
          isGlutenFree: false,
          isVegan: false,
          isDairyFree: false,
          isVegetarian: false
        };

        $scope.menuItem.name = 'pasta';
        $scope.menuItem.description = 'this is a delicious pasta';
        $scope.menuItem.price = 300;
        $scope.clearItem();
        expect($scope.menuItem).toEqual(menuItem);
      });
    it('should be called by $scope.saveMenuItem', function () {
      spyOn($scope, 'clearItem');
      $scope.saveMenuItem({ name: 'hello' });
      $httpBackend.flush();
      expect($scope.clearItem).toHaveBeenCalled();
    });
  });

  describe('$scope.deleteMenuItem', function () {
    it('should be a function on the scope object', function () {
      expect(typeof $scope.deleteMenuItem).toBe('function');
    });
    it('should make a delete request by calling $scope.menu.deleteMenuItem', function () {
      spyOn($scope.menu, 'deleteMenuItem').and.callThrough();
      $scope.deleteMenuItem(5);
      $httpBackend.flush();
      expect($scope.deleteStatus).toEqual(204);
      expect($scope.menu.deleteMenuItem).toHaveBeenCalled();
    });
    it('should throw an error when an error code is recieved', function () {
      $httpBackend.expectDELETE('api/vendor/menuItems').respond(500);
      $scope.deleteMenuItem(88);
      $httpBackend.flush();
      expect($scope.deleteStatus).toEqual(500);
    });
  });

  describe('$scope.saveMenuItem', function () {
    it('should be a function on the scope object', function () {
      expect(typeof $scope.saveMenuItem).toBe('function');
    });
    it('should make a post request calling $scope.menu.saveMenutItem', function () {
      spyOn($scope.menu, 'saveMenuItem').and.callThrough();
      $scope.saveMenuItem({ name: 'fajita' });
      $httpBackend.flush();
      expect($scope.menu.saveMenuItem).toHaveBeenCalled();
      expect($scope.saveStatus).toEqual(201);
    });
    it('should throw an error when an error code is recieved', function () {
      $httpBackend.expectPOST('api/vendor/menuItems').respond(500);
      $scope.saveMenuItem({ name: '<NAME>' });
      $httpBackend.flush();
      expect($scope.saveStatus).toEqual(500);
    });
  });
  describe('$scope.getMenu', function () {
    it('should be a function on th scope object', function () {
      expect(typeof $scope.getMenu).toBe('function');
    });
    it('should make a get request by calling vendor.getVendor', function () {
      spyOn(vendor, 'getVendor').and.callThrough();
      var data = {
        menuItems: [{}, {}, {}, {}]
      };
      $httpBackend.expectGET('/api/vendor').respond(data);
      $scope.getMenu(4567890);
      $httpBackend.flush();
      expect($scope.vendor.getVendor).toHaveBeenCalled();
      expect($scope.menu.items).toEqual(data.menuItems);

    });
  });
});

{'fraction_non_alphanumeric': 0.1618629509448368, 'fraction_numerical': 0.007444168734491315, 'mean_word_length': 2.952847981893625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5923008', 'n_tokens_mistral': 3101, 'n_tokens_neox': 3072, 'n_words': 605}