Skip to content

Commit

Permalink
Move dapp tests to the root test folder (#906)
Browse files Browse the repository at this point in the history
Depends on: #904

For consistency with other packages and projects we are moving the dapp
tests to the root test folder.

There are many possible approaches to organize the tests, but here we
are following the same structure as the other packages. If we need to
change this in the future, we can discuss and find the best approach.
  • Loading branch information
r-czajkowski authored Dec 9, 2024
2 parents 83b81ed + fb97fbf commit 1e48147
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
14 changes: 0 additions & 14 deletions dapp/src/tests/factories.ts

This file was deleted.

2 changes: 1 addition & 1 deletion dapp/src/sentry.test.ts → dapp/test/sentry.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest"
import * as Sentry from "@sentry/react"
import sentry from "./sentry"
import sentry from "#/sentry"

describe("sentry", () => {
describe("setUser", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import { beforeEach, describe, expect, it } from "vitest"
import { createActivity } from "#/tests/factories"
import { Activity } from "#/types"
import { WalletState } from "../wallet"
import reducer, { initialState, setActivities } from "../wallet/walletSlice"
import reducer, {
WalletState,
initialState,
setActivities,
} from "#/store/wallet/walletSlice"
import { dateToUnixTimestamp, randomInteger } from "#/utils"

const createActivity = (overrides: Partial<Activity> = {}): Activity => ({
id: crypto.randomUUID(),
initializedAt: dateToUnixTimestamp() - randomInteger(0, 1000000),
amount: BigInt(randomInteger(1000000, 1000000000)),
txHash: "c9625ecc138bbd241439f158f65f43e152968ff35e203dec89cfb78237d6a2d8",
status: "completed",
type: "deposit",
...overrides,
})

const isSignedMessage = false
const hasFetchedActivities = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"
import { getEstimatedDuration } from "../activities"
import { getEstimatedDuration } from "#/utils/activities"

describe("Utils functions for activities", () => {
describe("getEstimatedDuration", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"
import { roundUp } from "../numbers"
import { roundUp } from "#/utils/numbers"

describe("Utils functions for numbers", () => {
describe("roundUp", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Balance } from "@orangekit/react/dist/src/wallet/bitcoin-wallet-provide
import { AcreMessageType } from "@ledgerhq/wallet-api-acre-module"
import { ZeroAddress } from "ethers"
import BigNumber from "bignumber.js"
import AcreLedgerLiveBitcoinProvider from "../bitcoin-provider"
import AcreLedgerLiveBitcoinProvider from "#/utils/orangekit/ledger-live/bitcoin-provider"

describe("AcreLedgerLiveBitcoinProvider", () => {
const bitcoinAddress = "mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc"
Expand Down

0 comments on commit 1e48147

Please sign in to comment.