import React, { PropsWithChildren } from 'react' import { getText } from '.' describe('getText', () => { it('should return the text', () => { expect(getText('foo')).toBe('foo') }) it('should return the text with number input', () => { expect(getText(1)).toBe('1') }) it('should extract text from array input', () => { expect(getText([1, 2, 3])).toBe('123') }) it('should extract text from null input', () => { expect(getText(null)).toBe('') }) it('should extract text from undefined input', () => { expect(getText(undefined)).toBe('') }) it('should extract text from jsx input', () => { expect(getText(
foo
)).toBe('foo') }) it('should extract text from react fragment input', () => { expect(getText(<>foo)).toBe('foo') }) it('should extract text from custom components\' children', () => { function Foo({ children }: PropsWithChildren<{}>) { return {children} } expect(getText(bar)).toBe('bar') }) it('should extract text from nested jsx input', () => { expect(getText(
foo

bar baz

)).toBe('foobarbaz') }) it('should produce succinct result', () => { expect(getText(
foobar
)).toBe('foobar') }) it('should work well with text node', () => { const bar = 'bar' expect(getText(

foo{bar}

)).toBe('foobar') }) })