Skip to content

Commit

Permalink
feat(StockCenterInfoDisplay.test.tsx): add unit tests for StockCenter…
Browse files Browse the repository at this point in the history
…InfoDisplay component

This commit adds unit tests for the StockCenterInfoDisplay component. The tests verify that the component renders the mock content text and the heading text correctly. This ensures that the component is working as expected and that the content is being displayed correctly.
  • Loading branch information
ktun95 committed Feb 18, 2025
1 parent 0ccf646 commit 9b2dc45
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/ui-dsc/src/__tests__/StockCenterInfoDisplay.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { render, screen } from "@testing-library/react"
import { describe, it, expect } from "vitest"
import { StockCenterInfoDisplay } from "../home/StockCenterInfoDisplay"
import { mockContent, sampleText } from "../mocks/mockContent"

describe("StockCenterInfoDisplay", () => {
it("renders the mock content text", () => {
render(
<StockCenterInfoDisplay
content={JSON.stringify(mockContent)}
slug="mock-slug"
/>,
)
expect(screen.getByText(sampleText)).toBeInTheDocument()
})

it("renders the heading text", () => {
render(
<StockCenterInfoDisplay
content={JSON.stringify(mockContent)}
slug="mock-slug"
/>,
)
expect(screen.getByText("Welcome to Dicty Stock Center (DSC)")).toBeInTheDocument()

Check failure on line 24 in packages/ui-dsc/src/__tests__/StockCenterInfoDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/StockCenterInfoDisplay.test.tsx#L24

[prettier/prettier] Replace `screen.getByText("Welcome·to·Dicty·Stock·Center·(DSC)")` with `⏎······screen.getByText("Welcome·to·Dicty·Stock·Center·(DSC)"),⏎····`
})
})

0 comments on commit 9b2dc45

Please sign in to comment.