Skip to content

Commit

Permalink
chore: fix test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
algreasley committed Jun 26, 2024
1 parent cee11ed commit 0affb65
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 196 deletions.
145 changes: 48 additions & 97 deletions packages/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"@storybook/addon-links": "8.1.7",
"@storybook/react": "8.1.7",
"@storybook/react-vite": "8.1.7",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
"@types/d3": "7.4.3",
"@types/eslint": "8.56.10",
"@types/google.analytics": "^0.0.42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,38 @@ const historyMock3: HistoryEntry[] = [
},
]

const renderComponent = () =>
render(
<TestThemeProvider>
<Subscribe source$={lastPosition$} fallback="No data">
<LastPosition />
</Subscribe>
</TestThemeProvider>,
const renderComponent = async () =>
await act(async () =>
render(
<TestThemeProvider>
<Subscribe source$={lastPosition$} fallback="No data">
<LastPosition />
</Subscribe>
</TestThemeProvider>,
),
)

describe("LastPositions", () => {
beforeEach(() => {
analyticsMock.__resetMocks()
})

it("should render the initial last position value", () => {
it("should render the initial last position value", async () => {
const historyMock$ = new BehaviorSubject<HistoryEntry[]>(historyMock1)
analyticsMock.__setHistoryMock(historyMock$)

renderComponent()
await renderComponent()

expect(screen.getAllByTestId("lastPosition")[0].textContent).toBe(
`-2,713,309`,
)
})

it("should display the updated last position", () => {
it("should display the updated last position", async () => {
const historyMock$ = new BehaviorSubject<HistoryEntry[]>(historyMock1)
analyticsMock.__setHistoryMock(historyMock$)

renderComponent()
await renderComponent()

expect(screen.getAllByTestId("lastPosition")[0].textContent).toBe(
`-2,713,309`,
Expand All @@ -98,11 +100,11 @@ describe("LastPositions", () => {
)
})

it("should display positive and negative number correctly", () => {
it("should display positive and negative number correctly", async () => {
const historyMock$ = new BehaviorSubject<HistoryEntry[]>(historyMock1)
analyticsMock.__setHistoryMock(historyMock$)

renderComponent()
await renderComponent()

expect(screen.getAllByTestId("lastPosition")[0].textContent).toBe(
`-2,713,309`,
Expand Down
Loading

0 comments on commit 0affb65

Please sign in to comment.