bbc/psammead

View on GitHub
packages/utilities/psammead-rich-text-transforms/test/string.test.js

Summary

Maintainability
A
0 mins
Test Coverage
const { stringToRichText } = require('../src/index');

test('returns a paragraph block when given a string', () => {
  const mockString = 'Hello world';

  expect(stringToRichText(mockString)).toStrictEqual({
    type: 'text',
    model: {
      blocks: [
        {
          type: 'paragraph',
          model: {
            text: 'Hello world',
            blocks: [
              {
                type: 'fragment',
                model: {
                  text: 'Hello world',
                  attributes: [],
                },
              },
            ],
          },
        },
      ],
    },
  });
});