From 0434e7d6b651563524de3c73618ab0dd480febeb Mon Sep 17 00:00:00 2001 From: Julien Fabre Date: Wed, 13 Oct 2021 01:03:54 +0200 Subject: [PATCH] chore: Add test units for contentRegistry (#1521) --- .../content/contentRegistry.test.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 webapp/src/components/content/contentRegistry.test.tsx diff --git a/webapp/src/components/content/contentRegistry.test.tsx b/webapp/src/components/content/contentRegistry.test.tsx new file mode 100644 index 000000000..c0082be6b --- /dev/null +++ b/webapp/src/components/content/contentRegistry.test.tsx @@ -0,0 +1,22 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import '../content/textElement' +import '../content/imageElement' +import '../content/dividerElement' +import '../content/checkboxElement' + +import {contentBlockTypes} from '../../blocks/block' + +import {contentRegistry} from './contentRegistry' + +describe('components/content/ContentRegistry', () => { + test('have all contentTypes', () => { + expect(contentRegistry.contentTypes).toEqual(contentBlockTypes) + }) + test.each(contentBlockTypes)('have a contentType %s', (content) => { + expect(contentRegistry.isContentType(content)).toBeTruthy() + }) + test.each(contentBlockTypes)('get a contentHandler for %s', (content) => { + expect(contentRegistry.getHandler(content)).toBeTruthy() + }) +})