2022-04-12 22:50:34 +08:00
|
|
|
import * as vueShared from '@vue/shared'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
|
|
camelize,
|
|
|
|
capitalize,
|
|
|
|
escapeStringRegexp,
|
|
|
|
hyphenate,
|
|
|
|
kebabCase,
|
|
|
|
} from '..'
|
|
|
|
|
|
|
|
describe('strings', () => {
|
|
|
|
it('escapeStringRegexp should work', () => {
|
|
|
|
expect(escapeStringRegexp('foo')).toMatchInlineSnapshot('"foo"')
|
|
|
|
expect(escapeStringRegexp('**\\//aa^~#$')).toMatchInlineSnapshot(
|
|
|
|
'"\\\\*\\\\*\\\\\\\\//aa\\\\^~#\\\\$"'
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2022-09-07 00:26:17 +08:00
|
|
|
it('capitalize', () => {
|
|
|
|
;['capitalize', 'camelize', 'hyphenate'].forEach((item) => {
|
|
|
|
expect(capitalize(item)).toBe(vueShared.capitalize(item))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-04-12 22:50:34 +08:00
|
|
|
it('re-export from @vue/shared', () => {
|
|
|
|
expect(camelize).toBe(vueShared.camelize)
|
|
|
|
expect(hyphenate).toBe(vueShared.hyphenate)
|
|
|
|
expect(kebabCase).toBe(vueShared.hyphenate)
|
|
|
|
})
|
|
|
|
})
|