import { beforeSetup, generateNetworkResult, intercept, intoMenu, successIntercept, validateDelete, validatePut, validateTableList, validateTableSearch, } from './utils'; const basicData = { id: '23', code: '1000', name: '充电设备事业部成品库', tldId: 'fa4e9d0a-8dac-4d8d-9', specificationAndModel: null, unitOfMeasurement: null, materialId: null, num: null, type: '0', tableName: null, size: null, materialType: null, wllbClass: null, isNotDisable: null, isRecommend: null, partType: null, page: 0, limit: 0, amount: null, minNum: null, maxNum: null, modifyUser: null, modifyTime: null, typeVal: null, companyNumber: null, warehouseType: '产成品仓库', nameOrCode: null, }; describe('字典列表, 只用仓库管理做测试', function() { beforeEach(function() { beforeSetup(); intoMenu('基础资料', '仓库管理'); }); beforeEach(function() { intercept('/dictionary/getDictionaryPage', function({reply, search}) { generateNetworkResult({ reply, search, basicData, title: 'tldId', skipCondition: name => name === 'type', }); }); successIntercept([ '/dictionary/updateDictionary', '/dictionary/addDictionary', '/dictionary/deleteDictionary', '/maintenance/updateWarehouse', ]); }); it('table', function() { validateTableList('dictionary_table'); validateTableSearch( 'dictionary_table', [ 'dictionaryName', 'dictionaryCode', {id: 'warehouseType', type: 'select', value: '0'}, ], {toolId: 'dictionary_filter', url: '/dictionary/getDictionaryPage'}, ); }); it('operation', function() { const {validateAdd, validateEdit} = validatePut( 'dicionary_modal', 'dictionary_table', {label: '仓库'}, ); validateAdd(['dictionaryId', 'dictionaryName', 'dictionaryCode']); validateEdit([{id: 'storageType', type: 'select', value: '产成品仓库'}]); validateDelete('dictionary_table', '仓库', {title: basicData.name}); }); });