Skip to content

Commit

Permalink
test: 更新单元测试 修复 ts 类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyh2001 committed May 8, 2024
1 parent 661ce51 commit 99d6569
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions packages/fighting-design/_utils/compatible/__test__/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from 'vitest'
import { objectEntries } from '..'

const data = {
a: 1,
b: 2,
c: 3
}

test('objectEntries', () => {
/**
* @see toStrictEqual https://cn.vitest.dev/api/expect.html#tostrictequal
*/
expect(objectEntries(data)).toStrictEqual([
['a', 1],
['b', 2],
['c', 3]
])
})
6 changes: 3 additions & 3 deletions packages/fighting-design/_utils/install/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type Install<T> = T & {
* @returns { Object } 组件实例
*/
export const install = <T extends Component>(main: T): Install<T> => {
(main as Record<string, any>).install = (app: App) => {
(main as Record<string, any>).install = (app: App): void => {
const { name } = main
name && app.component(name, main)
}
Expand All @@ -26,7 +26,7 @@ export const install = <T extends Component>(main: T): Install<T> => {
* @returns { Object } 组件实例
*/
export const installFn = <T>(main: T, name: string): Install<T> => {
(main as Install<T>).install = (app: App) => {
(main as Install<T>).install = (app: App): void => {
app.config.globalProperties[name] = main as Install<T>
}
return main as Install<T>
Expand All @@ -43,7 +43,7 @@ export const installDirective = <T extends Directive>(
main: T,
name: string
): Install<T> => {
(main as Install<T>).install = (app: App) => {
(main as Install<T>).install = (app: App): void => {
app.directive(name, main as Install<T>)
}
return main as Install<T>
Expand Down

0 comments on commit 99d6569

Please sign in to comment.