-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UIE-206 App Startup - unit tests pt3 #5277
base: dev
Are you sure you want to change the base?
Conversation
7b6dd1a
to
4616dab
Compare
- additional unit test coverage on startup flow. - moved more startup bits to src/libs/startup - improved type-safety on configStore, updated related tests/mock usage. - some light Typescript conversion
- additional unit test coverage on startup flow. - moved more startup bits to src/libs/startup - improved type-safety on configStore, updated related tests/mock usage. - some light Typescript conversion
- fixed build info types to not come from json file, which is not there during github build flow.
- fixed assert not being mocked for underlying getConfig() call in WorkspaceContainer tests
|
}; | ||
|
||
export const withDebouncedChange = (WrappedComponent) => { | ||
export const withDebouncedChange = (WrappedComponent: React.FC<any>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a later pass on these types here and below can improve beyond props type "any" to use generic
props passthru type-flow.
fontSize: 14, | ||
backgroundColor: props.disabled ? colors.dark(0.25) : undefined, | ||
}, | ||
const numberInputChild = div([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no functional change, just auto-formatting
@@ -1,6 +1,7 @@ | |||
import { TooltipTrigger, useWindowDimensions } from '@terra-ui-packages/components'; | |||
import Downshift from 'downshift'; | |||
import _ from 'lodash/fp'; | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input.ts was part of a change I decided to back out of,. But here I kept the effort I put into a partial Typescript conversion. No functional changes... some minor Typesecript-surfaced linting errors fixed.
@@ -1 +0,0 @@ | |||
export const loadedConfigStore = { current: undefined }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to src/libs/startup/configStore.ts
export const getBuildTimestamp = (): number => { | ||
const timeRaw: number | string = getConfig().buildTimestamp; | ||
const timeStamp = typeof timeRaw === 'number' ? timeRaw : parseInt(timeRaw, 10); | ||
return timeStamp; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript surfaced that the timestamp conversion from string might be an error since buildTimestamp config field is a raw number in local .json file.... to play it safe, that field is typed as string | nubmer, and this helper does conversion if and only if needed.
loadedConfig.current = nullConfig.current; | ||
}; | ||
|
||
export const loadedConfigStore = (): AppConfigSettings | undefined => loadedConfig.current; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configStore used to just export a raw object. Changing the module to provide access functions adds more useful structure and ease of mocking/managing in tests.
@@ -0,0 +1,34 @@ | |||
import { partial } from 'src/testing/test-utils'; | |||
|
|||
import { AppConfigSettings, loadedConfigStore, resetConfigStore, setLoadedConfigStore } from './configStore'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a typo in the file name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't this so... file exptension are ignosred on import filenames... and it's working without issue in build/test run.
Jira Ticket: https://broadworkbench.atlassian.net/browse/[Ticket #]
Summary of changes:
What
Why
Testing strategy