/*eslint dot-notation: "off"*/
/*eslint no-shadow: "off"*/

import {replace, when} from '../../../../test-helper';

describe.only('the products controller', () => {
  let productsService;
  let ProductsController;
  let productsController;

  let makeProductsControllerWith = (productsService) => {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);
  };

  beforeEach(() => {
    productsService = require('./service/products-service').productsService();
    replace(productsService, 'fetch');
    when(productsService.fetch()).thenResolve(['products']);
  });

  it('has no products', () => {
    makeProductsControllerWith(productsService);
    productsController.products.should.deepEqual([]);
  });

  it('fetches products from the server', () => {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);

    return productsController.fetch().then(() => {
      productsController.products.should.deepEqual(['products']);
    });
  });
});



@@ -377,36 +377,22 @@
 '%5D;%0A    
-productsController =
+return
  new Pro
@@ -673,16 +673,37 @@
 =%3E %7B%0A   
+ productsController =
  makePro
@@ -846,33 +846,33 @@
 r', () =%3E %7B%0A    
-P
+p
 roductsControlle
@@ -879,111 +879,34 @@
 r = 
-require('./products.controller')%5B'ProductsController'%5D;%0A    productsController = new ProductsController
+makeProductsControllerWith
 (pro

call extracted method