Skip to content

Commit

Permalink
test: attempting at fixing tests flackyness (#2933)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Burtey <[email protected]>
  • Loading branch information
nicolasburtey and Nicolas Burtey authored Dec 15, 2023
1 parent 689a17d commit 98a2974
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions __tests__/hooks/use-display-currency.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PropsWithChildren } from "react"
import * as React from "react"
import { IsAuthedContextProvider } from "@app/graphql/is-authed-context"
import { CurrencyListDocument, RealtimePriceDocument } from "@app/graphql/generated"
import { act } from "react-test-renderer"

const mocksNgn = [
{
Expand Down Expand Up @@ -136,11 +137,16 @@ const wrapWithMocks =
describe("usePriceConversion", () => {
describe("testing moneyAmountToMajorUnitOrSats", () => {
it("with 0 digits", async () => {
const { result, waitForNextUpdate } = renderHook(useDisplayCurrency, {
const { result } = renderHook(useDisplayCurrency, {
wrapper: wrapWithMocks(mocksJpy),
})

await waitForNextUpdate()
await act(
() =>
new Promise((resolve) => {
setTimeout(resolve, 10)
}),
)

const res = result.current.moneyAmountToMajorUnitOrSats({
amount: 100,
Expand Down

0 comments on commit 98a2974

Please sign in to comment.