From e2fc553420c93fabc2522240f15682cc21da797b Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 13 Dec 2023 19:02:06 -0600 Subject: [PATCH] Remove silly test, use for...in --- src/view/nova/lib/__tests__/utils.test.ts | 24 ----------------------- src/view/nova/lib/system.tsx | 11 +++++++---- 2 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 src/view/nova/lib/__tests__/utils.test.ts diff --git a/src/view/nova/lib/__tests__/utils.test.ts b/src/view/nova/lib/__tests__/utils.test.ts deleted file mode 100644 index a12b6aac29..0000000000 --- a/src/view/nova/lib/__tests__/utils.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {test, expect} from '@jest/globals' - -import * as utils from '../utils' - -test(`web`, async () => { - const result = utils.web('foo') - expect(result).toBe(undefined) -}) - -test(`ios`, async () => { - const result = utils.ios('foo') - // TODO will fail in CI - expect(result).toBe('foo') -}) - -test(`android`, async () => { - const result = utils.android('foo') - expect(result).toBe(undefined) -}) - -test(`native`, async () => { - const result = utils.native('foo') - expect(result).toBe('foo') -}) diff --git a/src/view/nova/lib/system.tsx b/src/view/nova/lib/system.tsx index dc0219eb89..c27818edb0 100644 --- a/src/view/nova/lib/system.tsx +++ b/src/view/nova/lib/system.tsx @@ -109,13 +109,16 @@ export function createSystem< const {theme} = useTheme() const breakpoints = useBreakpoints() return React.useMemo(() => { - return Object.entries(styles).reduce((acc, [key, style]) => { + const acc = {} as { + [Name in keyof O]: ReturnType['styles'] + } + for (const key in styles) { acc[key as keyof O] = theme.style( - style as StylesAndProps, + styles[key] as StylesAndProps, breakpoints.active, ).styles - return acc - }, {} as {[Name in keyof O]: ReturnType['styles']}) + } + return acc // eslint-disable-next-line react-hooks/exhaustive-deps }, [styles, breakpoints.current, theme]) }