<commit_before>import { test } from 'ava'
import { Generator, Mocker, Schema } from '../../'

const gen = new Generator()
const mocker = new Mocker()

test('Should be "lorem.words"', async t => {
    let res = gen.faker({ faker: 'lorem.words' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words()"', async t => {
    let res = gen.faker({ faker: 'lorem.words()' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words(1)"', async t => {
    let res = gen.faker({ faker: 'lorem.words(1)' })
    t.true(typeof res === 'string')
})

test('Should be "random.number({"max": 1})"', async t => {
    let res = gen.faker({ faker: 'random.number({"max": 1})' })
    t.true(typeof res === 'number')
    t.true(res <= 1)
})

test('Should be "random.number({"min": 1, "max": 2})"', async t => {
    let res = gen.faker({ faker: 'random.number({"min": 1, "max": 2})' })
    t.true(typeof res === 'number')
    t.true(res <= 2)
    t.true(res >= 1)
})

test('Should be "lorem.words()[0]"', async t => {
    let res = gen.faker({ faker: 'lorem.words()[0]' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words(1)[0]""', async t => {
    let res = gen.faker({ faker: 'lorem.words(1)[0]' })
    t.true(typeof res === 'string')
})

test('Should use locale "address.streetAddress"', async t => {
    let res = gen.faker({ faker: 'address.streetAddress', locale: 'de_CH' })
    console.log(res)
    t.true(typeof res === 'string')
})

test('Should use locale "address.streetAddress"', async t => {
    let res = gen.faker({ faker: 'address.streetAddress', locale: 'zh_CN' })
    console.log(res)
    t.true(typeof res === 'string')
    t.true(res.match(/[\u3400-\u9FBF]/) && res.match(/[\u3400-\u9FBF]/).length > 0)
})

test('Should use locale "address.streetAddress"', async t => {
    gen.faker({ faker: 'address.streetAddress', locale: 'zh_CN' })
    let res = gen.faker({ faker: 'address.streetAddress' })
    console.log(res)
    t.true(typeof res === 'string')
    t.true(res.match(/[\u3400-\u9FBF]/) === null)
})

test('Faker lang not affect others', async t => {
    let street = {
        str1: { faker: 'address.streetAddress', locale: 'zh_CN' },
        str2: { faker: 'address.streetAddress' }
    }

    let schema = new Schema('street', street, 1)
    let data = schema.build()
    let res = data[0]

    t.true(typeof res.str1 === 'string')
    t.true(typeof res.str2 === 'string')
    t.true(res.str1.match(/[\u3400-\u9FBF]/).length > 0)
    t.true(res.str2.match(/[\u3400-\u9FBF]/) === null)<commit_msg>chore(test): fix console logs<commit_after>import { test } from 'ava'
import { Generator, Mocker, Schema } from '../../'

const gen = new Generator()
const mocker = new Mocker()

test('Should be "lorem.words"', async t => {
    let res = gen.faker({ faker: 'lorem.words' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words()"', async t => {
    let res = gen.faker({ faker: 'lorem.words()' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words(1)"', async t => {
    let res = gen.faker({ faker: 'lorem.words(1)' })
    t.true(typeof res === 'string')
})

test('Should be "random.number({"max": 1})"', async t => {
    let res = gen.faker({ faker: 'random.number({"max": 1})' })
    t.true(typeof res === 'number')
    t.true(res <= 1)
})

test('Should be "random.number({"min": 1, "max": 2})"', async t => {
    let res = gen.faker({ faker: 'random.number({"min": 1, "max": 2})' })
    t.true(typeof res === 'number')
    t.true(res <= 2)
    t.true(res >= 1)
})

test('Should be "lorem.words()[0]"', async t => {
    let res = gen.faker({ faker: 'lorem.words()[0]' })
    t.true(typeof res === 'string')
})

test('Should be "lorem.words(1)[0]""', async t => {
    let res = gen.faker({ faker: 'lorem.words(1)[0]' })
    t.true(typeof res === 'string')
})

test('Should use locale "address.streetAddress"', async t => {
    let res = gen.faker({ faker: 'address.streetAddress', locale: 'de_CH' })
    t.true(typeof res === 'string')
})

test('Should use locale "address.streetAddress"', async t => {
    let res = gen.faker({ faker: 'address.streetAddress', locale: 'zh_CN' })
    t.true(typeof res === 'string')
    t.true(res.match(/[\u3400-\u9FBF]/) && res.match(/[\u3400-\u9FBF]/).length > 0)
})

test('Should use locale "address.streetAddress"', async t => {
    gen.faker({ faker: 'address.streetAddress', locale: 'zh_CN' })
    let res = gen.faker({ faker: 'address.streetAddress' })
    t.true(typeof res === 'string')
    t.true(res.match(/[\u3400-\u9FBF]/) === null)
})

test('Faker lang not affect others', async t => {
    let street = {
        str1: { faker: 'address.streetAddress', locale: 'zh_CN' },
        str2: { faker: 'address.streetAddress' }
    }

    let schema = new Schema('street', street, 1)
    let data = schema.build()
    let res = data[0]

    t.true(typeof res.str1 === 'string')
    t.true(typeof res.str2 === 'string')
    t.true(res.str1.match(/[\u3400-\u9FBF]/).length > 0)
    t.true(res.str2.match(/[\u3400-\u9FBF]/) === null)
{'fraction_non_alphanumeric': 0.22327603240466312, 'fraction_numerical': 0.020549298557597313, 'mean_word_length': 3.3413379073756433, 'pattern_counts': {'":': 12, '<': 7, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '512482', 'n_tokens_mistral': 1952, 'n_tokens_neox': 1876, 'n_words': 439}