const Param = require('../util/param')
const Rule = require('../util/rule')

const { describe, it } = require('mocha')
const { expect } = require('chai')

describe('class param', function () {
  it('test param invalid rules', function () {
    let rules = {
      phone: ['test', 'require', Rule.Reg_Phone],
      code: ['test', 'require', Rule.Reg_Code]
    }
    let param = new Param(null, rules)
    expect(param.checkParams()).to.equal(false)
  })

  it('test param valid rules', function () {
    let rules = {
      phone: ['13826254683', 'require', Rule.Reg_Phone],
      code: ['123456', 'require', Rule.Reg_Code]
    }
    let param = new Param(null, rules)
    expect(param.checkParams()).to.equal(true)
  })
})
