docs: catalog of stubs, mocks, and test stand-ins in repo #105

Closed
opened 2026-04-22 03:24:22 +00:00 by PlasticDigits · 15 comments
PlasticDigits commented 2026-04-22 03:24:22 +00:00 (Migrated from gitlab.com)

Summary

This issue catalogs stubs, test doubles, and non-production stand-ins found in the cl8y-dex-terraclassic repo (snapshot audit). It is a checklist for engineers to know what is intentional test infrastructure vs what might be mistaken for “unfinished app code.”

This is not an accusation of technical debt in every case — most items are expected in tests. Use it for onboarding and to avoid duplicating work.

Test / tooling stubs (intentional)

Location What
indexer/tests/common/lcd_mock.rs Wiremock-backed LCD HTTP stub for cosmwasm smart queries in API tests.
indexer/tests/api_limit_book_lcd_mock.rs, api_orderbook_lcd_mock.rs, etc. LCD mocks for orderbook and limit-book routes.
frontend-dapp/src/services/indexer/__tests__/client.test.ts vi.stubGlobal('fetch', …) for client unit tests.
frontend-dapp/src/services/terraclassic/__tests__/pair.test.ts (and similar) vi.mock for queries / transactions.
smartcontracts/.../orderbook.rs (unit tests) cosmwasm_std::testing::mock_dependencies().
docs/testing.md States contract calls are stubbed at the service layer in frontend unit tests.
docs/indexer-invariants.md References Wiremock stub for pool smart query.

Mock addresses and fixtures (not chain deployments)

  • router.test.ts, wrapMapper.test.ts, types/__tests__/helpers.test.ts — MOCK_LUNC_C / MOCK_USTC_C placeholder terra1 strings for unit tests.

E2E conditional skips (behavioral “gaps” not code stubs)

  • Multiple e2e/*.spec.ts use test.skip(...) when LocalTerra is down, no route, no balance, or pair paused — this hides failures (see separate issue to make pool-tx strict).
  • e2e/helpers/chain.ts — skips when LCD unreachable.

Architecture / product language (“not implemented” in docs, not a code TODO)

  • docs/reviews/20260409T030009Z/ARCHITECTURE_GAP_MATRIX.md — row “Best execution logic — not implemented server-side” (design statement).
  • indexer/src/api/orderbook_sim.rs — Simulated AMM orderbook for CG/CMC (curve walk), not the on-chain FIFO book — name overlap can confuse readers.

“Shallow” book API (product limit, not a mock)

  • GET .../limit-book-shallow with default depth 10, max 20 — real endpoint; intentionally bounded (see deep book epic).

package-lock integrity field

  • integrity string containing substring w1x32s/... matched grep; not a code stub.

Not found (in targeted scan)

  • Widespread TODO / FIXME / unimplemented! in app TS/TSX or contracts src — no large backlog of TODO comments surfaced by repo-wide search (aside from test/docs contexts above).

Action

  • Triagers: add comments in lcd_mock.rs and orderbook_sim.rs if confusion persists between AMM-sim vs on-chain book.
  • Link this issue from CONTRIBUTING or docs/testing.md if helpful.

Labels suggested

documentation, testing, onboarding

## Summary This issue **catalogs stubs, test doubles, and non-production stand-ins** found in the **cl8y-dex-terraclassic** repo (snapshot audit). It is a **checklist** for engineers to know what is **intentional test infrastructure** vs what might be mistaken for “unfinished app code.” **This is not an accusation of technical debt in every case** — most items are **expected** in tests. Use it for onboarding and to avoid duplicating work. ## Test / tooling stubs (intentional) | Location | What | |----------|------| | `indexer/tests/common/lcd_mock.rs` | **Wiremock**-backed **LCD HTTP stub** for cosmwasm smart queries in API tests. | | `indexer/tests/api_limit_book_lcd_mock.rs`, `api_orderbook_lcd_mock.rs`, etc. | **LCD mocks** for orderbook and limit-book routes. | | `frontend-dapp/src/services/indexer/__tests__/client.test.ts` | `vi.stubGlobal('fetch', …)` for client unit tests. | | `frontend-dapp/src/services/terraclassic/__tests__/pair.test.ts` (and similar) | `vi.mock` for `queries` / `transactions`. | | `smartcontracts/.../orderbook.rs` (unit tests) | `cosmwasm_std::testing::mock_dependencies()`. | | `docs/testing.md` | States contract calls are **stubbed at the service layer** in frontend unit tests. | | `docs/indexer-invariants.md` | References **Wiremock** stub for `pool` smart query. | ## Mock *addresses* and fixtures (not chain deployments) - `router.test.ts`, `wrapMapper.test.ts`, `types/__tests__/helpers.test.ts` — `MOCK_LUNC_C` / `MOCK_USTC_C` **placeholder terra1** strings for **unit** tests. ## E2E conditional skips (behavioral “gaps” not code stubs) - Multiple `e2e/*.spec.ts` use **`test.skip(...)`** when LocalTerra is down, no route, no balance, or pair paused — this **hides** failures (see separate issue to make **pool-tx** strict). - `e2e/helpers/chain.ts` — skips when **LCD** unreachable. ## Architecture / product language (“not implemented” in docs, not a code TODO) - `docs/reviews/20260409T030009Z/ARCHITECTURE_GAP_MATRIX.md` — row **“Best execution logic — not implemented server-side”** (design statement). - `indexer/src/api/orderbook_sim.rs` — **Simulated AMM orderbook** for CG/CMC (curve walk), **not** the on-chain FIFO book — name overlap can confuse readers. ## “Shallow” book API (product limit, not a mock) - `GET .../limit-book-shallow` with **default depth 10, max 20** — real endpoint; **intentionally bounded** (see **deep book** epic). ## `package-lock` integrity field - `integrity` string containing substring `w1x32s/...` matched grep; **not** a code stub. ## Not found (in targeted scan) - Widespread `TODO` / `FIXME` / `unimplemented!` in **app** TS/TSX or **contracts** `src` — **no large backlog** of `TODO` comments surfaced by repo-wide search (aside from test/docs contexts above). ## Action - [ ] Triagers: add **comments** in `lcd_mock.rs` and `orderbook_sim.rs` if confusion persists between **AMM-sim** vs **on-chain book**. - [ ] Link this issue from `CONTRIBUTING` or `docs/testing.md` if helpful. ## Labels suggested `documentation`, `testing`, `onboarding`
PlasticDigits commented 2026-04-22 03:24:50 +00:00 (Migrated from gitlab.com)

mentioned in issue #107

mentioned in issue #107
PlasticDigits commented 2026-04-22 04:57:12 +00:00 (Migrated from gitlab.com)

mentioned in commit 2d4e9e114d

mentioned in commit 2d4e9e114d4a0191d7b3b70ab340a17577026cf9
PlasticDigits commented 2026-04-22 04:57:29 +00:00 (Migrated from gitlab.com)

@brouie Could you verify this matches what you had in mind for #105?

Done (merged to main in 2d4e9e1):

  • indexer/tests/common/lcd_mock.rs — Module docs now state this is a Wiremock LCD HTTP stub only, not the on-chain FIFO book, and point to orderbook_sim + issue #105.
  • indexer/src/api/orderbook_sim.rs — Module-level //! docs clarify AMM curve-walk / CG–CMC-style synthetic depth vs the pair contract limit order book, and that tests often pair this with lcd_mock.
  • docs/testing.md — Short paragraph linking issue #105 and naming the two indexer files for quick orientation.

No CONTRIBUTING.md exists in the repo, so the catalog link lives in the testing doc per the issue checklist.

Verification: cargo fmt --check and cargo test --lib in indexer/ passed on the branch before merge.

If anything should be worded differently or cross-linked elsewhere, say the word.

@brouie Could you verify this matches what you had in mind for #105? **Done (merged to `main` in 2d4e9e1):** - **`indexer/tests/common/lcd_mock.rs`** — Module docs now state this is a Wiremock LCD HTTP stub only, not the on-chain FIFO book, and point to `orderbook_sim` + issue #105. - **`indexer/src/api/orderbook_sim.rs`** — Module-level `//!` docs clarify AMM curve-walk / CG–CMC-style synthetic depth vs the pair contract limit order book, and that tests often pair this with `lcd_mock`. - **`docs/testing.md`** — Short paragraph linking [issue #105](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/105) and naming the two indexer files for quick orientation. No `CONTRIBUTING.md` exists in the repo, so the catalog link lives in the testing doc per the issue checklist. **Verification:** `cargo fmt --check` and `cargo test --lib` in `indexer/` passed on the branch before merge. If anything should be worded differently or cross-linked elsewhere, say the word.
Brouie commented 2026-04-22 06:27:46 +00:00 (Migrated from gitlab.com)

@PlasticDigits acknowledging — this reads as a dev-owned catalog with 2 minor triager actions (code comments in lcd_mock.rs + orderbook_sim.rs, and linking from CONTRIBUTING/testing.md). No QA action. Ping when the comment/link changes land and I'll verify.

@PlasticDigits acknowledging — this reads as a dev-owned catalog with 2 minor triager actions (code comments in lcd_mock.rs + orderbook_sim.rs, and linking from CONTRIBUTING/testing.md). No QA action. Ping when the comment/link changes land and I'll verify.
PlasticDigits commented 2026-04-22 06:53:45 +00:00 (Migrated from gitlab.com)

@Brouie Commit is merged

@Brouie Commit is merged
Brouie commented 2026-04-23 03:51:14 +00:00 (Migrated from gitlab.com)

@PlasticDigits verified on 2d4e9e1.

Module docs in lcd_mock.rs and orderbook_sim.rs now clearly distinguish three concepts that were previously confusable:

  • Wiremock LCD HTTP stub (tests/common/lcd_mock.rs) — only fakes REST surface
  • AMM-sim orderbook (indexer/src/api/orderbook_sim.rs) — production constant-product curve walk for depth quotes
  • On-chain FIFO limit book — actual resting orders with price-time priority

docs/testing.md cross-links the catalog. Good fix for a real naming footgun.

Closing as verified.

@PlasticDigits verified on `2d4e9e1`. Module docs in `lcd_mock.rs` and `orderbook_sim.rs` now clearly distinguish three concepts that were previously confusable: - Wiremock LCD HTTP stub (tests/common/lcd_mock.rs) — only fakes REST surface - AMM-sim orderbook (indexer/src/api/orderbook_sim.rs) — production constant-product curve walk for depth quotes - On-chain FIFO limit book — actual resting orders with price-time priority `docs/testing.md` cross-links the catalog. Good fix for a real naming footgun. Closing as verified.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-23 03:51:16 +00:00
PlasticDigits commented 2026-05-26 08:00:37 +00:00 (Migrated from gitlab.com)

mentioned in issue #199

mentioned in issue #199
PlasticDigits commented 2026-05-29 03:11:32 +00:00 (Migrated from gitlab.com)

mentioned in issue #210

mentioned in issue #210
PlasticDigits commented 2026-05-29 03:11:33 +00:00 (Migrated from gitlab.com)

marked as related to #210

marked as related to #210
PlasticDigits commented 2026-05-29 03:13:21 +00:00 (Migrated from gitlab.com)

mentioned in issue #211

mentioned in issue #211
PlasticDigits commented 2026-05-29 05:40:52 +00:00 (Migrated from gitlab.com)

mentioned in issue #225

mentioned in issue #225
PlasticDigits commented 2026-05-29 05:41:06 +00:00 (Migrated from gitlab.com)

mentioned in issue #227

mentioned in issue #227
PlasticDigits commented 2026-05-29 05:41:09 +00:00 (Migrated from gitlab.com)

marked as related to #227

marked as related to #227
PlasticDigits commented 2026-05-29 05:41:53 +00:00 (Migrated from gitlab.com)

mentioned in issue #230

mentioned in issue #230
PlasticDigits commented 2026-05-29 05:41:56 +00:00 (Migrated from gitlab.com)

marked as related to #230

marked as related to #230
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#105
No description provided.