CI / build-and-test (push) Canceled after 0s
以 ckcloudManage a44810c 为基础,只保留资产页面(台账、单据、基础数据、同步任务)、 登录/错误/个人资料等公共页面,以及资产单据“查看流程”用到的流程详情页; 统一登录应用编码默认 CK_ASSET,标题“资产管理”,本地端口 9090。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import {
|
|
is,
|
|
isArray,
|
|
isBoolean,
|
|
isDef,
|
|
isEmpty,
|
|
isFunction,
|
|
isNull,
|
|
isNumber,
|
|
isObject,
|
|
isString,
|
|
isUnDef,
|
|
isUrl
|
|
} from '@/utils/is'
|
|
|
|
describe('utils/is', () => {
|
|
it('基础类型判断', () => {
|
|
expect(is(new Date(), 'Date')).toBe(true)
|
|
expect(isDef(0)).toBe(true)
|
|
expect(isUnDef(undefined)).toBe(true)
|
|
expect(isObject({})).toBe(true)
|
|
expect(isObject(null)).toBe(false)
|
|
expect(isObject([])).toBe(false)
|
|
expect(isNull(null)).toBe(true)
|
|
expect(isNumber(1)).toBe(true)
|
|
expect(isNumber('1')).toBe(false)
|
|
expect(isString('a')).toBe(true)
|
|
expect(isFunction(() => 1)).toBe(true)
|
|
expect(isBoolean(false)).toBe(true)
|
|
expect(isArray([1])).toBe(true)
|
|
})
|
|
|
|
it('isEmpty 覆盖空值、字符串、数组、Map/Set 与对象', () => {
|
|
expect(isEmpty(null)).toBe(true)
|
|
expect(isEmpty(undefined)).toBe(true)
|
|
expect(isEmpty('')).toBe(true)
|
|
expect(isEmpty([])).toBe(true)
|
|
expect(isEmpty(new Map())).toBe(true)
|
|
expect(isEmpty(new Set([1]))).toBe(false)
|
|
expect(isEmpty({})).toBe(true)
|
|
expect(isEmpty({ a: 1 })).toBe(false)
|
|
expect(isEmpty(0)).toBe(false)
|
|
})
|
|
|
|
it('isUrl 识别外链', () => {
|
|
expect(isUrl('https://cxtest.zjsck.com:8443/portal/')).toBe(true)
|
|
expect(isUrl('http://a.com/x?y=1#z')).toBe(true)
|
|
expect(isUrl('/system/user')).toBe(false)
|
|
})
|
|
})
|