import ObjConfig from '../../../src/plugins/GerJsonConfig'

import Vue from "vue";

describe('配置文件转换', () => {


  it('数组对象转换对象', async () => {
  var arr = [
  {
    "lname": "燃气表",
    "checkmust":false,
    "items":[
      {"lname": "表具状态","isstart":true,"multiple":false,"type":"selector","options":[{"data":"正常","isdefect":false,"isdefault": true},{"data":"包裹","isdefect":true,"level":"C2","isdefault": false,"tooltip":"1.整改时限1日，2，禁止使用，及时联系公司客服"},{"data":"漏气","isdefect":true,"level":"A1","isdefault": false,"tooltip":"1.整改时限1日，2，禁止使用，及时联系公司客服"}]},
      {"lname": "表故障","multiple":true,"type":"selector","options":[{"data":"正常","isdefect":false,"isdefault": true},{"data":"破损变形","isdefect":true,"level":"B2","isdefault": false,"tooltip":"1.整改时限1日，2，禁止使用，及时联系公司客服"},{"data":"失效","isdefect":true,"level":"B2","isdefault": false},{"data":"不走字","isdefect":true,"level":"B2","isdefault": false},{"data":"铅封损坏","isdefect":true,"level":"B2","isdefault": false},{"data":"气表到期(使用年限超过八年)","isdefect":true,"level":"B2","isdefault": false}]},
      {"lname": "腐蚀","multiple":false,"type":"selector","options":[{"data":"正常","isdefect":false,"isdefault": true},{"data":"轻微","isdefect":false,"isdefault": false},{"data":"中度","isdefect":false,"isdefault": false},{"data":"严重","isdefect":true,"level":"A2","isdefault": false,"tooltip":"1.整改时限1日，2，禁止使用，及时联系公司客服"}]},
      {"lname": "使用年限","type":"string", "data": 8,"isshow": false}
    ]
  },
  {
    "lname": "阀门",
    "checkmust":true,
    "items":[
      {"lname": "阀门","multiple":true,"type":"selector","options":[{"data":"无阀门","isdefect":true,"level":"A2"},{"data":"无阀柄","isdefect":true,"level":"A2"},{"data":"失效","isdefect":true,"level":"A2"}]},
      {"lname": "表前阀","multiple":false,"type":"selector","options":[{"data":"正常","isdefect":false,"isdefault": true},{"data":"异常","isdefect":true,"level":"A1","isdefault": false}]},
      {"lname": "灶前阀","multiple":false,"type":"selector","options":[{"data":"正常","isdefect":false,"isdefault": true},{"data":"异常","isdefect":true,"level":"A1","isdefault": false}]},
      {"lname":"使用年限","type":"string", "data": 8,"isshow": false}
    ]
  }
]
    var obj = ObjConfig.getObjConfig(arr,11)
    console.log(JSON.stringify(obj))

  })


})
