<fim-prefix>ean')
  t.same(add(null, new Date('2016')), new Date('2016'), 'should add a param with default option date')
  t.same(add(null, /123/i), /123/i, 'should add a param with default option regexp')
  t.equal(add(123, String), '123', 'should add a param with type option string')
  t.equal(add('123', Number), 123, 'should add a param with type option number')
  t.equal(add('123', Boolean), true, 'should add a param with type option boolean')
  t.same(add('2016', Date), new Date('2016'), 'should add a param with type option date')
  t.same(add('123', RegExp), /123/i, 'should add a param with type option regexp')

  t.same(add(null, ['123']), '123', 'should add a param with default option string array')
  t.same(add(null, [123]), 123, 'should add a param with default option number array')
  t.same(add(null, [true]), true, 'should add a param with default option boolean array')
  t.same(add(null, [new Date('2016')]), new Date('2016'), 'should add a param with default option date array')
  t.same(add(null, [/123/i]), /123/i, 'should add a param with default option regexp array')
  t.same(add(123, [String]), '123', 'should add a param with type option string array')
  t.same(add('123,456', [Number]), [123, 456], 'should add a param with type option number array')
  t.same(add('123,0', [Boolean]), [true, false], 'should add a param with type option boolean array')
  t.same(add('2016,2017', [Date]), [new Date('2016'), new Date('2017')], 'should add a param with type option date array')
  // BUG: CWE-915 Improperly Controlled Modification of Dynamically-Determined Object Attributes
  // t.same(add('123,456', [RegExp]), [/123/i, /123/i], 'should add a param with type option regexp array')
  // FIXED:
 <fim-middle> t.same(add('123,456', [RegExp]), [/123/i, /456/i], 'should add a param with type option regexp array')
  t.end()
})

test('QuerymenSchema get', (t) => {
  let mySchema = schema()
  mySchema.add('test'<fix-suffix>)
  t.false(schema().get('test'), 'should not get a nonexistent param')
  t.true(mySchema.get('test'), 'should get a param')
  t.end()
})

test('QuerymenSchema set', (t) => {
  let mySchema = schema()
  mySchema.add('test')
  t.false(schema().set('test', '123'), 'should not set a nonexistent param')
  t.true(mySchema.set('test', '123'), 'should set a param')
  t.true(mySchema.set('test', '123', {test: true}).option('test'), 'should set param option')
  t.end()
})

test('QuerymenSchema option', (t) => {
  let mySchema = schema()
  t.equal(mySchema.option('test', false), false, 'should set option')
  t.equal(mySchema.option('test'), false, 'should get option')
  t.false(mySchema.add('test'), 'should not add disallowed param')
  t.end()
})

test('QuerymenSchema param', (t) => {
  let mySchema = schema()
  t.false(mySchema.param('test'), 'should not get a nonexistent param')
  t.true(mySchema.param('test', null), 'should add a param')
  t.true(mySchema.param('test'), 'should get a param')
<|endoftext|>