diff --git a/webapp/src/components/content/__snapshots__/contentElement.test.tsx.snap b/webapp/src/components/content/__snapshots__/contentElement.test.tsx.snap new file mode 100644 index 000000000..8b8f5102d --- /dev/null +++ b/webapp/src/components/content/__snapshots__/contentElement.test.tsx.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/content/contentElement return an element 1`] = ` +
+
+ + +
+
+`; diff --git a/webapp/src/components/content/contentElement.test.tsx b/webapp/src/components/content/contentElement.test.tsx new file mode 100644 index 000000000..95c8bee97 --- /dev/null +++ b/webapp/src/components/content/contentElement.test.tsx @@ -0,0 +1,52 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import {render} from '@testing-library/react' + +import {wrapIntl} from '../../testUtils' + +import {ContentBlock} from '../../blocks/contentBlock' + +import ContentElement from './contentElement' + +describe('components/content/contentElement', () => { + test('return an element', () => { + const contentBlock: ContentBlock = { + id: 'test-id', + workspaceId: '', + parentId: '', + rootId: '', + modifiedBy: 'test-user-id', + schema: 0, + type: 'checkbox', + title: 'test-title', + fields: {}, + createdBy: 'test-user-id', + createAt: 0, + updateAt: 0, + deleteAt: 0, + } + const checkBoxElement = ContentElement({block: contentBlock, readonly: false}) + const {container} = render(wrapIntl(checkBoxElement)) + expect(container).toMatchSnapshot() + }) + + test('return null', () => { + const contentBlock: ContentBlock = { + id: 'test-id', + workspaceId: '', + parentId: '', + rootId: '', + modifiedBy: 'test-user-id', + schema: 0, + type: 'unknown', + title: 'test-title', + fields: {}, + createdBy: 'test-user-id', + createAt: 0, + updateAt: 0, + deleteAt: 0, + } + const contentElement = ContentElement({block: contentBlock, readonly: false}) + expect(contentElement).toBeNull() + }) +})