Skip to content

Commit

Permalink
MMT-3418: Fixed the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmistry1 committed Jan 4, 2024
1 parent f2ac653 commit 7a3c2fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ describe('CustomTextWidget', () => {
describe('when the input is a number field', () => {
test('renders a number field', () => {
setup({
uiSchema: {
'ui:type': 'number'
schema: {
type: 'number'
}
})

Expand Down
6 changes: 5 additions & 1 deletion static/src/js/components/GridRow/__tests__/GridRow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ describe('when there is a group title', () => {
})

expect(GridGroupedSinglePanel).toHaveBeenCalledTimes(1)
expect(GridGroupedSinglePanel).toHaveBeenCalledWith(props, {})
expect(GridGroupedSinglePanel).toHaveBeenCalledWith(expect.objectContaining({
idSchema: props.idSchema,
onChange: props.onChange,
schema: props.schema
}), {})
})
})

Expand Down
10 changes: 7 additions & 3 deletions static/src/js/components/OneOfField/OneOfField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,16 @@ class OneOfField extends React.Component {
OneOfField.defaultProps = {
baseType: null,
errorSchema: null,
formData: {},
uiSchema: {}
formData: undefined,
uiSchema: undefined
}

OneOfField.propTypes = {
formData: PropTypes.shape({}),
formData: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.shape({})
]),
options: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
registry: PropTypes.shape({
schemaUtils: PropTypes.shape({
Expand Down
12 changes: 9 additions & 3 deletions static/src/js/utils/__tests__/getUiSchema.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import serviceUiSchema from '../../schemas/uiSchemas/services'
import toolsUiSchema from '../../schemas/uiSchemas/tools'
import variableUiSchema from '../../schemas/uiSchemas/variables'
import getUiSchema from '../getUiSchema'

describe('getUiSchema', () => {
Expand All @@ -15,10 +16,9 @@ describe('getUiSchema', () => {
})
})

// TODO MMT-3418
describe('when the concept type is variable-draft', () => {
test.skip('returns the UMM-V schema', () => {
expect(getUiSchema('Variable')).toEqual('Replace with Variable uiSchema')
test('returns the UMM-V schema', () => {
expect(getUiSchema('Variable')).toEqual(variableUiSchema)
})
})

Expand All @@ -28,4 +28,10 @@ describe('getUiSchema', () => {
expect(getUiSchema('Collection')).toEqual('Replace with Collection uiSchema')
})
})

describe('when the concept type is not recognized', () => {
test('returns null', () => {
expect(getUiSchema('bad-draft')).toEqual(null)
})
})
})

0 comments on commit 7a3c2fd

Please sign in to comment.