Remove silly test, use for...in

This commit is contained in:
Eric Bailey
2023-12-13 19:02:06 -06:00
parent db7ba3be15
commit e2fc553420
2 changed files with 7 additions and 28 deletions
-24
View File
@@ -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')
})
+7 -4
View File
@@ -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<SystemTheme['style']>['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<SystemTheme['style']>['styles']})
}
return acc
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [styles, breakpoints.current, theme])
}