Skip to content

Commit

Permalink
tests: mock flaky test in order for it to not fail randomly in CI (#2102
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yaboiishere authored Feb 20, 2025
1 parent 4220311 commit 10f2a6c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/ae_mdw_web/controllers/name_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ defmodule AeMdwWeb.NameControllerTest do
alias AeMdw.Db.Name
alias AeMdw.Db.Store
alias AeMdw.Db.MemStore
alias AeMdw.Db.NullStore
alias AeMdw.Node.Db
alias AeMdw.TestSamples, as: TS
alias AeMdw.Txs
alias AeMdw.Validate
alias AeMdw.Db.Util, as: DbUtil

import AeMdwWeb.BlockchainSim, only: [with_blockchain: 3, name_tx: 3, tx: 3]
import AeMdw.Db.ModelFixtures, only: [new_name: 0]
Expand Down Expand Up @@ -1290,8 +1292,13 @@ defmodule AeMdwWeb.NameControllerTest do
end

test "renders empty result when no blocks", %{conn: conn, store: store} do
assert %{"data" => [], "next" => nil, "prev" => nil} =
conn |> get("/v3/names/auctions") |> with_store(store) |> json_response(200)
with_mocks [
{:aec_db, [], [get_header: fn _id -> :header end]},
{:aec_headers, [], [time_in_msecs: fn :header -> 1 end]}
] do
assert %{"data" => [], "next" => nil, "prev" => nil} =
conn |> get("/v3/names/auctions") |> with_store(store) |> json_response(200)
end
end

test "renders error when parameter by is invalid", %{conn: conn} do
Expand Down

0 comments on commit 10f2a6c

Please sign in to comment.