From 95d0efa4d34d70e8df3f46e4803d83f9b941be3d Mon Sep 17 00:00:00 2001 From: XieZongChen <46394163+amadeus711@users.noreply.github.com> Date: Sun, 15 Aug 2021 09:44:05 -0500 Subject: [PATCH] test(utils): add test (#877) --- src/_utils/tests/Utils.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/_utils/tests/Utils.spec.ts b/src/_utils/tests/Utils.spec.ts index a5b106d41..26669960b 100644 --- a/src/_utils/tests/Utils.spec.ts +++ b/src/_utils/tests/Utils.spec.ts @@ -1,8 +1,10 @@ import { createHoverColor, createPressedColor } from '../color' import { call, + createDataKey, formatLength, getTitleAttribute, + keysOf, largerSize, smallerSize } from '..' @@ -83,4 +85,16 @@ describe('vue', () => { expect(testValue).toBe(3) expect(testValue2).toBe(4) }) + + it('should work with createDataKey', () => { + expect(createDataKey('1')).toBe('s-1') + expect(createDataKey(1)).toBe('n-1') + }) + + it('should work with keep', () => { + const test = { c: 3 } + const test2 = { a: 1, b: 2, d: test } + expect(keysOf(test).toString()).toBe(['c'].toString()) + expect(keysOf(test2).toString()).toBe(['a', 'b', 'd'].toString()) + }) })