utils.test.ts 508 字节
Newer Older
L
LeoKu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import localeEN from '../i18n/locales/en'
import localeZH from '../i18n/locales/zh'
import { highlightJSON } from '../utils'

test('highlightJSON', () => {
  const str = JSON.stringify({ a: 1, b: '2' })
  expect(highlightJSON(str)).toMatch('key')
  expect(highlightJSON(str)).toMatch('number')
  expect(highlightJSON(str)).toMatch('string')
})

test('check locales completeness', () => {
  const zh = Reflect.ownKeys(localeZH).sort()
  const en = Reflect.ownKeys(localeEN).sort()
  expect(zh).toEqual(en)
})