import {
  beforeSetup,
  exportIntercept,
  generateNetworkResult,
  intercept,
  intoMenu,
  validateExport,
  validateTableList,
  validateTableSearch,
} from './utils';

const basicData = {
  materialName: '测试产品1',
  amount: 0,
  wllbCode: 'TELD_0001',
  maxNum: '12',
  minNum: '4',
};

describe('物料储量预警', function () {
  beforeEach(function () {
    beforeSetup();
    intoMenu('库内管理', '物料储量预警');
  });

  beforeEach(function () {
    intercept('/queryList/reserveWarnings', function ({reply, search}) {
      generateNetworkResult({reply, search, basicData, title: 'wllbCode'});
    });

    exportIntercept('/queryList/reserveWarningsExport');
  });

  it('table', function () {
    validateTableList('reserve_warning_table');

    validateTableSearch('reserve_warning_table', ['wllbCode', 'materialName'], {
      toolId: 'reserves_warning_filter',
      url: '/queryList/reserveWarnings',
    });

    validateExport('reserve_warning_table');
  });
});
