Commit b132752
Add routing unit tests and comprehensive integration tests (#39)
* Add comprehensive unit tests for actix routing logic
Extract inline permission and validation checks from route handlers into
named pure functions, then cover them with unit tests. Follows the
existing pattern established in boards/routes.rs.
- boards/mod.rs: extract check_cards_allowed / check_voting_allowed; 6 tests
- cards/mod.rs: extract check_card_owner; 4 tests
- cards/routes.rs: extract validate_card_text; 5 tests
- columns/routes.rs: extract check_board_owner_permission; 5 tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove unnecessary extractions from purpose-built functions
boards/mod.rs and cards/mod.rs already had named functions
(assert_cards_allowed, assert_voting_allowed, assert_card_owner) for this
logic — no extraction needed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add comprehensive routing integration tests
34 tests covering the full HTTP request/response cycle through the actix
middleware stack against a live Firestore emulator. Tests are #[ignore]
and run with: FIRESTORE_EMULATOR_HOST=localhost:8080 cargo test -- --ignored
Coverage:
- Boards: create, list, get, update, delete — including owner/non-owner
permission cases and not-found handling
- Columns: create, list, get, update, delete — owner-only mutation checks
- Cards: create (validation + cards-closed gate), list, get, update,
delete, vote (including voting-closed gate), react, CSV export
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Reuse FirestoreDb connection for cleanup in integration tests
Each test now clones the db before passing it to make_app!, keeping a
handle for cleanup rather than opening a second emulator connection.
Also removes a stray no-op emulator_db().await call.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Split integration_tests.rs into per-domain submodules
Move flat 1193-line file into src/integration_tests/ with
board_tests.rs, column_tests.rs, card_tests.rs submodules.
Shared infrastructure (emulator_db, test_config, make_app!,
session_cookie, body_json, setup_board, setup_board_and_column)
stays in mod.rs. Macro uses fully-qualified crate paths to work
when expanded in child modules.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Address review feedback: fix redundant unit tests and fill coverage gaps
- Collapse board_owner_can_update_column + board_owner_can_delete_column
(identical tests of the same function) into board_owner_is_permitted,
and non_owner_cannot_update/delete_column into non_owner_is_forbidden
- Add delete_as_non_owner_returns_403 integration test for cards
- Add update_as_non_owner_with_anyone_is_owner_still_returns_403 integration
test for columns (anyone_is_owner only applies to board settings)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Dylan <dylan@encapto.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent cb0ae57 commit b132752
7 files changed
Lines changed: 1431 additions & 14 deletions
File tree
- src
- cards
- columns
- integration_tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
| |||
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
| |||
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
0 commit comments