File size: 451 Bytes
23ac194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict'

const { test } = require('node:test')
const fjs = require('..')

test('fix-604', t => {
  const schema = {
    type: 'object',
    properties: {
      fullName: { type: 'string' },
      phone: { type: 'number' }
    }
  }

  const input = {
    fullName: 'Jone',
    phone: 'phone'
  }

  const render = fjs(schema)

  t.assert.throws(() => {
    render(input)
  }, { message: 'The value "phone" cannot be converted to a number.' })
})