From 99d65699b384842e97fd256b6aa0ea84dfa77963 Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Wed, 8 May 2024 20:27:18 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=20=E4=BF=AE=E5=A4=8D=20ts=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_utils/compatible/__test__/utils.spec.ts | 19 +++++++++++++++++++ .../fighting-design/_utils/install/index.ts | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 packages/fighting-design/_utils/compatible/__test__/utils.spec.ts diff --git a/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts new file mode 100644 index 0000000000..0815f68538 --- /dev/null +++ b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts @@ -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] + ]) +}) diff --git a/packages/fighting-design/_utils/install/index.ts b/packages/fighting-design/_utils/install/index.ts index e955cb43a4..6b95484ae2 100644 --- a/packages/fighting-design/_utils/install/index.ts +++ b/packages/fighting-design/_utils/install/index.ts @@ -11,7 +11,7 @@ export type Install = T & { * @returns { Object } 组件实例 */ export const install = (main: T): Install => { - (main as Record).install = (app: App) => { + (main as Record).install = (app: App): void => { const { name } = main name && app.component(name, main) } @@ -26,7 +26,7 @@ export const install = (main: T): Install => { * @returns { Object } 组件实例 */ export const installFn = (main: T, name: string): Install => { - (main as Install).install = (app: App) => { + (main as Install).install = (app: App): void => { app.config.globalProperties[name] = main as Install } return main as Install @@ -43,7 +43,7 @@ export const installDirective = ( main: T, name: string ): Install => { - (main as Install).install = (app: App) => { + (main as Install).install = (app: App): void => { app.directive(name, main as Install) } return main as Install