diff --git a/src/@types/Form.d.ts b/src/@types/Form.d.ts
index 63e11a9d5..4a88b4128 100644
--- a/src/@types/Form.d.ts
+++ b/src/@types/Form.d.ts
@@ -12,7 +12,7 @@ export interface FormFieldProps {
export interface FormContent {
title: string
- description: string
+ description?: string
success: string
data: FormFieldProps[]
}
diff --git a/src/components/atoms/Alert.stories.tsx b/src/components/atoms/Alert.stories.tsx
index a97b92228..98705b7c6 100644
--- a/src/components/atoms/Alert.stories.tsx
+++ b/src/components/atoms/Alert.stories.tsx
@@ -1,6 +1,6 @@
import React from 'react'
import { Center } from '../../../.storybook/helpers'
-import { Alert } from './Alert'
+import Alert from './Alert'
export default {
title: 'Atoms/Alert',
diff --git a/src/components/atoms/Loader.stories.tsx b/src/components/atoms/Loader.stories.tsx
index 0022b64fc..eef84e4d3 100644
--- a/src/components/atoms/Loader.stories.tsx
+++ b/src/components/atoms/Loader.stories.tsx
@@ -12,7 +12,3 @@ export const Normal = () =>
export const WithMessage = () => (
)
-
-export const WithMessageHorizontal = () => (
-
-)
diff --git a/src/components/atoms/Table/ActionsCell.tsx b/src/components/atoms/Table/ActionsCell.tsx
index 1f8d6ba4b..c91318358 100644
--- a/src/components/atoms/Table/ActionsCell.tsx
+++ b/src/components/atoms/Table/ActionsCell.tsx
@@ -1,4 +1,4 @@
-import React from 'react'
+import React, { ReactElement } from 'react'
import Eye from '../../../images/eye.svg'
import Button from '../Button'
import Tooltip from '../Tooltip'
@@ -10,7 +10,7 @@ export declare type ActionsCellProps = {
export default function ActionsCell({
handleOnClickViewJobDetails
-}: ActionsCellProps) {
+}: ActionsCellProps): ReactElement {
return (
<>
{handleOnClickViewJobDetails && (
diff --git a/src/components/molecules/AssetTeaser.stories.tsx b/src/components/molecules/AssetTeaser.stories.tsx
index fc562b70d..956f60059 100644
--- a/src/components/molecules/AssetTeaser.stories.tsx
+++ b/src/components/molecules/AssetTeaser.stories.tsx
@@ -7,4 +7,9 @@ export default {
title: 'Molecules/Asset Teaser'
}
-export const Default = () =>
+export const Default = () => (
+
+)
diff --git a/src/components/molecules/FilesInput/Input.tsx b/src/components/molecules/FilesInput/Input.tsx
index 8e2ee0282..897694fde 100644
--- a/src/components/molecules/FilesInput/Input.tsx
+++ b/src/components/molecules/FilesInput/Input.tsx
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react'
import isUrl from 'is-url-superb'
import Button from '../../atoms/Button'
-import Input from '../../atoms/Input'
import { useField } from 'formik'
import Loader from '../../atoms/Loader'
+import InputElement from '../../atoms/Input/InputElement'
export default function FileInput({
handleButtonClick,
@@ -17,7 +17,7 @@ export default function FileInput({
return (
<>
-
+
) : (
{
- it('renders without crashing', () => {
- act(() => {
- const { container } = render(
- {
- /* */
- }}
- onFocus={() => {
- /* */
- }}
- onChange={() => {
- /* */
- }}
- options={{}}
- required={false}
- />
- )
- expect(container.firstChild).toBeInTheDocument()
- })
- })
-
- it('getWidgetValue returns a correctly encoded string', () => {
- expect(
- getWidgetValue(
- new Date('2020-03-15T15:13:30.123Z'),
- new Date('2020-03-18T15:13:30.456Z'),
- false
- )
- ).toEqual('["2020-03-15T15:13:30Z","2020-03-15T15:13:30Z"]')
-
- expect(
- getWidgetValue(
- new Date('2020-03-15T15:13:30.123Z'),
- new Date('2020-03-18T18:13:30.456Z'),
- true
- )
- ).toEqual('["2020-03-15T15:13:30Z","2020-03-18T18:13:30Z"]')
- })
-})
diff --git a/tests/unit/components/Layout.test.tsx b/tests/unit/components/Layout.test.tsx
index 94589267b..1f59d3df0 100644
--- a/tests/unit/components/Layout.test.tsx
+++ b/tests/unit/components/Layout.test.tsx
@@ -12,7 +12,9 @@ describe('Layout', () => {
testRender(
- Hello
+
+ Hello
+
)
})
diff --git a/tests/unit/components/PublishForm.test.tsx b/tests/unit/components/PublishForm.test.tsx
index de690f009..7e08352f5 100644
--- a/tests/unit/components/PublishForm.test.tsx
+++ b/tests/unit/components/PublishForm.test.tsx
@@ -1,80 +1,30 @@
import React from 'react'
import { render } from '@testing-library/react'
-import Form, {
- transformErrors
-} from '../../../src/components/molecules/FilesInput'
-import {
- publishFormData,
- PublishFormDataInterface,
- PublishFormSchema,
- PublishFormUiSchema
-} from '../../../src/models/PublishForm'
-import testFormData from '../__fixtures__/testFormData'
import { transformPublishFormToMetadata } from '../../../src/components/pages/Publish/utils'
-import { MetaDataMarket } from '../../../src/@types/MetaData'
+import {
+ MetaDataMarket,
+ MetaDataPublishForm
+} from '../../../src/@types/MetaData'
+import PublishForm from '../../../src/components/pages/Publish/PublishForm'
+import publishFormData from '../__fixtures__/testFormData'
+import content from '../../../content/pages/publish.json'
describe('PublishForm', () => {
it('renders without crashing', async () => {
- const { container } = render(
-
- )
+ const { container } = render()
expect(container.firstChild).toBeInTheDocument()
})
- it('transformErrors() passes through data', () => {
- const errorsMock = [
- {
- message: 'Hello',
- name: 'Hello',
- params: 'Hello',
- property: 'Hello',
- stack: 'Hello'
- }
- ]
-
- const error = transformErrors(errorsMock)
- expect(error[0].message).toBe('Hello')
- })
-
- it('transformErrors() transforms data', () => {
- const errorsMock = [
- {
- message: 'Hello',
- name: 'Hello',
- params: 'Hello',
- property: '.termsAndConditions',
- stack: 'Hello'
- }
- ]
-
- const error = transformErrors(errorsMock)
- expect(error[0].message).not.toBe('Hello')
- })
-
it('Form data is correctly transformed to asset MetaData', () => {
- const data: PublishFormDataInterface = publishFormData
+ const data: MetaDataPublishForm = publishFormData
let metadata: MetaDataMarket = transformPublishFormToMetadata(data)
expect(metadata.additionalInformation).toBeDefined()
expect(metadata.main).toBeDefined()
- data.price = 1.3
- data.dateRange = '["2020-03-05T15:17:31Z","2020-03-10T16:00:00Z"]'
+ data.price = '1.3'
metadata = transformPublishFormToMetadata(data)
expect(metadata.main.price).toBe('1300000000000000000')
- expect(metadata.additionalInformation.dateRange).toEqual([
- '2020-03-05T15:17:31Z',
- '2020-03-10T16:00:00Z'
- ])
})
})