From bc6588187bff854e50e8bab790144b5143180c97 Mon Sep 17 00:00:00 2001 From: Sweety Sharma <126869417+sweetyTW@users.noreply.github.com> Date: Fri, 3 Nov 2023 01:05:34 +0530 Subject: [PATCH] test: add test for TextContent component (#133) Co-authored-by: Jayanthan --- .../TextContent/__snapshots__/test.tsx.snap | 120 ++++++++++++++++++ src/packages/TextContent/test.tsx | 52 ++++++++ 2 files changed, 172 insertions(+) create mode 100644 src/packages/TextContent/__snapshots__/test.tsx.snap create mode 100644 src/packages/TextContent/test.tsx diff --git a/src/packages/TextContent/__snapshots__/test.tsx.snap b/src/packages/TextContent/__snapshots__/test.tsx.snap new file mode 100644 index 0000000..39c9947 --- /dev/null +++ b/src/packages/TextContent/__snapshots__/test.tsx.snap @@ -0,0 +1,120 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` Should render text content in different variants of color 1`] = ` +.c0 { + font-size: 1.4rem; + color: #222222; +} + +.c1 { + font-size: 1.6rem; + color: #222222; +} + +.c2 { + font-size: 1.8rem; + color: #222222; +} + +
+ + This is a statement + + + This is a statement + + + This is a statement + +
+`; + +exports[` Should render text content in different variants of size 1`] = ` +.c0 { + font-size: 1.4rem; + color: #F8F7FB; +} + +.c1 { + font-size: 1.4rem; + color: #222222; +} + +.c2 { + font-size: 1.4rem; + color: #022B54; +} + +.c3 { + font-size: 1.4rem; + color: #53C3D0; +} + +
+ + This is a statement + + + This is a statement + + + This is a statement + + + This is a statement + +
+`; + +exports[` Should render text content in different variants of tag 1`] = ` +.c0 { + font-size: 1.4rem; + color: #222222; +} + +
+

+ This is a statement +

+ + This is a statement + + + This is a statement + + + This is a statement + + + This is a statement + +
+`; diff --git a/src/packages/TextContent/test.tsx b/src/packages/TextContent/test.tsx new file mode 100644 index 0000000..bea1418 --- /dev/null +++ b/src/packages/TextContent/test.tsx @@ -0,0 +1,52 @@ +import React from 'react' +import { render, screen } from '../../utils/testUtils' + +import TextContent from '.' + +describe('', () => { + it('Should render text content', () => { + render() + const text = screen.getByText('This is a statement') + + expect(text).toBeInTheDocument() + }) + + it('Should render text content in different variants of tag', () => { + const { container } = render( + <> + + + + + + + ) + + expect(container).toMatchSnapshot() + }) + + it('Should render text content in different variants of size', () => { + const { container } = render( + <> + + + + + + ) + + expect(container).toMatchSnapshot() + }) + + it('Should render text content in different variants of color', () => { + const { container } = render( + <> + + + + + ) + + expect(container).toMatchSnapshot() + }) +})