Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR introduces a seeded dummy data generator (
|
| Filename | Overview |
|---|---|
| src/ui/testing.rs | New dummy data generator using the fake crate; contains a compile error: unconditional use bench_support::... breaks when --features benches is active. |
| tests/support/mod.rs | New shared test helper that centralises buffer_to_string (with correct trailing-line stripping) for all integration test files — good improvement. |
| tests/issue_preview.rs | New snapshot tests for IssuePreview; AppState::new arguments are passed in the wrong order (owner/repo swapped), producing incorrect snapshot data. |
| tests/status_bar.rs | New snapshot test for StatusBar; AppState::new arguments are swapped, causing the snapshot to display "repo/owner" instead of "owner/repo". |
| tests/text_search.rs | New snapshot tests for TextSearch; AppState::new arguments are swapped, though this doesn't visibly affect the text-search snapshots since it doesn't render the repo/owner label. |
| tests/title_bar.rs | New snapshot test for TitleBar; no AppState dependency, uses shared support helper correctly. |
| tests/help.rs | New snapshot tests for HelpComponent covering keybinds-only, text-wrapping, mixed content, and empty states; no issues found. |
| src/ui/mod.rs | testing module correctly gated with #[cfg(test)]; no production code change. |
| src/ui/issue_data.rs | Adds intern_test_author (gated by #[cfg(test)]) and upsert_issue helper; correctly scoped and no production impact. |
| Cargo.toml | Adds fake = "4.4.0" and insta = "1.40" to [dev-dependencies] only — correctly scoped, no production binary impact. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[cargo test] --> B{benches feature?}
B -- OFF --> C[src/ui/testing.rs compiled with cfg test]
B -- ON --> D[src/ui/testing.rs compiled with cfg test]
C --> E[local mod bench_support stubs used]
E --> F[use bench_support resolves OK]
F --> G[dummy_ui_data_with builds DummyUiData]
D --> H[use crate::bench_support real fixtures]
D --> I[use bench_support ERROR - no local module]
I --> J[compile error]
G --> K[tests/support/mod.rs\nbuffer_to_string centralised]
K --> L[tests/issue_preview.rs]
K --> M[tests/status_bar.rs]
K --> N[tests/text_search.rs]
K --> O[tests/title_bar.rs]
K --> P[tests/help.rs]
L --> Q[AppState::new swapped args\nrepo=owner owner=repo]
M --> Q
N --> Q
Q --> R[Incorrect snapshot: repo/owner\ninstead of owner/repo]
Last reviewed commit: e1c789a
72606cc to
e1c789a
Compare
| let mut preview = IssuePreview::new(AppState::new( | ||
| "owner".to_string(), | ||
| "repo".to_string(), | ||
| "user".to_string(), | ||
| )); |
There was a problem hiding this comment.
AppState::new argument order swapped
AppState::new is declared as new(repo: String, owner: String, current_user: String) (repo first, owner second), but the call here passes "owner" as the first argument (bound to repo) and "repo" as the second (bound to owner). This causes the wrong values to be stored, and the bug is visible in the committed status_bar snapshot, which displays repo/owner instead of owner/repo.
The same swap occurs in tests/text_search.rs (lines 18–22) and tests/status_bar.rs (lines 19–23).
| let mut preview = IssuePreview::new(AppState::new( | |
| "owner".to_string(), | |
| "repo".to_string(), | |
| "user".to_string(), | |
| )); | |
| let mut preview = IssuePreview::new(AppState::new( | |
| "repo".to_string(), | |
| "owner".to_string(), | |
| "user".to_string(), | |
| )); |
| #[allow(unused_imports)] | ||
| use bench_support::{issue_body_fixture, markdown_fixture}; |
There was a problem hiding this comment.
Unconditional use bench_support fails to compile with --features benches
The local mod bench_support {} stub is only compiled when cfg(not(feature = "benches")) is active. When the benches feature IS enabled, that module does not exist, so use bench_support::{issue_body_fixture, markdown_fixture} cannot resolve the path and produces a compile error. The #[allow(unused_imports)] only suppresses an unused-import warning; it cannot suppress a path-resolution error.
Running cargo test --features benches will fail to compile this module because of this line.
The fix is to gate this use statement the same way as the stub module:
| #[allow(unused_imports)] | |
| use bench_support::{issue_body_fixture, markdown_fixture}; | |
| #[cfg(not(feature = "benches"))] | |
| use bench_support::{issue_body_fixture, markdown_fixture}; |
e1c789a to
d4351a9
Compare
d4351a9 to
1bf264a
Compare
Merge activity
|
1bf264a to
00d175a
Compare

test(ui): add dummy test data generator
test(ui): add UI snapshot tests for the TUI components