A free and open-source block-based email template builder.
TypeScript amazonsesdeveloper-toolsemailemail-editoremail-marketingemail-templateemail-template-builderemailapiemailjshtml-email-editorno-codenocode-email-editoropen-source-email-buildersendgridtransactional-emailswysiwyg-email-editorwysiwyg-html-editor
import React from 'react';
import { z } from 'zod';
import { describe, expect, it } from '@jest/globals';
import { render } from '@testing-library/react';
import buildBlockComponent from '../../src/builders/buildBlockComponent';
describe('builders/buildBlockComponent', () => {
it('renders the specified component', () => {
const BlockComponent = buildBlockComponent({
SampleBlock: {
schema: z.object({ text: z.string() }),
Component: ({ text }) => <div>{text.toUpperCase()}</div>,
},
});
expect(render(<BlockComponent type="SampleBlock" data={{ text: 'Test text!' }} />).asFragment()).toMatchSnapshot();
});
});