test(utils): add test (#877)

This commit is contained in:
XieZongChen 2021-08-15 09:44:05 -05:00 committed by GitHub
parent d6ef91dfd6
commit 95d0efa4d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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())
})
})