Skip to content

Commit 9fbb742

Browse files
committed
chore: 添加测试用例
1 parent ecfea73 commit 9fbb742

8 files changed

Lines changed: 57 additions & 48 deletions

File tree

src/crypto/CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
| ID | Time | T | Title | Read |
99
|----|------|---|-------|------|
10+
| #1012 | 6:43 PM | 🔵 | Found PasskeySeed type definition | ~57 |
11+
| #1011 | " | 🔵 | Found Passkey::to_seed() method returning SensitiveString | ~54 |
1012
| #458 | 2:01 PM | 🟣 | KeyHierarchy save/unlock implementation committed with complete key wrapping | ~202 |
1113
| #455 | 2:00 PM | 🔄 | KeyHierarchy unlock method signature reordered to match test expectations | ~159 |
1214
| #453 | " | 🔄 | Dangling derive_master_key code removed from KeyHierarchy implementation | ~113 |

src/tui/CLAUDE.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@
77

88
| ID | Time | T | Title | Read |
99
|----|------|---|-------|------|
10-
| #507 | 2:16 PM | 🔴 | Autocomplete filter closure dereference fixed | ~28 |
11-
| #506 | " | 🟣 | TUI command autocomplete functionality implemented with prefix matching and multiple match handling | ~258 |
12-
| #505 | " | 🔴 | TUI autocomplete filter expression fixed to handle borrowed values correctly | ~48 |
13-
| #502 | 2:15 PM | 🔵 | TUI app command submission workflow processes user input through command handlers | ~169 |
14-
| #501 | " | 🟣 | Autocomplete handler call added to TUI tab key handling | ~134 |
15-
| #498 | " | 🔵 | TUI app handle_char method processes keyboard input with special cases | ~178 |
16-
| #491 | 2:14 PM | 🟣 | TUI action handlers for settings, sync, and configuration committed to git | ~196 |
17-
| #481 | 2:04 PM | 🟣 | TUI action handlers updated with improved messaging and screen navigation | ~44 |
18-
| #478 | 2:03 PM | 🔵 | TUI handle_key_event method routes events through screen navigation and keybinding manager | ~201 |
19-
| #477 | " | 🔵 | TUI event handler defines keyboard shortcuts for sync-related actions | ~172 |
20-
| #469 | " | 🔵 | TUI module structure includes app, commands, handler, keybindings, screens, and widgets | ~209 |
21-
| #465 | 2:02 PM | 🔵 | TUI screen enumeration defines five screen types including provider selection and configuration | ~192 |
22-
| #463 | " | 🔵 | TUI application structure includes sync status tracking and screen management | ~194 |
23-
| #460 | " | 🔵 | TUI app shows TODO placeholders for sync and settings functionality | ~167 |
10+
| #1108 | 7:02 PM | 🟣 | Added sync screen rendering to TuiApp::render() method | ~128 |
11+
| #1107 | " | 🔵 | Found screen navigation and rendering patterns in app.rs | ~246 |
12+
| #1106 | " | 🔵 | Confirmed Screen::Sync variant exists in Screen enum | ~212 |
13+
| #1105 | " | 🔵 | Found render pattern for screens in app.rs | ~108 |
14+
| #1104 | 7:01 PM | 🔵 | Sync variant already exists in Screen enum | ~209 |
15+
| #1103 | " | 🟣 | Phase 4.2: F5 key now navigates to Sync screen | ~217 |
16+
| #1102 | " | 🔴 | Found F5 key handler with TODO for sync screen | ~192 |
17+
| #1101 | " | 🔵 | TuiApp imports screens module but not sync screen yet | ~102 |
18+
| #1100 | " | 🟣 | Added sync_screen field to TuiApp struct | ~62 |
19+
| #1099 | 7:00 PM | 🟣 | Added sync_screen field to TuiApp initialization | ~66 |
20+
| #1098 | " | 🔵 | TuiApp::new() initialization requires sync_screen field | ~208 |
21+
| #1097 | " | 🔵 | Found TuiApp struct with existing screen states | ~249 |
22+
| #1096 | " | 🔵 | Found F5 key handler with TODO for sync screen integration | ~216 |
23+
| #1095 | " | 🔵 | TuiApp struct needs sync_screen field added | ~191 |
24+
| #1086 | 6:55 PM | 🟣 | Added Sync variant to Screen::name() method | ~147 |
25+
| #1085 | 6:54 PM | 🔵 | Found existing SyncStatus struct near Screen enum | ~188 |
26+
| #1084 | " | 🟣 | Added Sync variant to Screen enum | ~175 |
27+
| #1083 | " | 🔵 | Found Screen enum in app.rs | ~190 |
28+
| #1082 | " | 🔵 | Found Screen enum in app.rs | ~146 |
2429
</claude-mem-context>

tests/CLAUDE.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@
77

88
| ID | Time | T | Title | Read |
99
|----|------|---|-------|------|
10-
| #513 | 2:19 PM | 🟣 | Nonce validator test suite created with 6 test functions | ~194 |
11-
| #503 | 2:15 PM | 🟣 | TUI command autocomplete test suite created with six test functions | ~234 |
12-
| #491 | 2:14 PM | 🟣 | TUI action handlers for settings, sync, and configuration committed to git | ~196 |
13-
| #483 | 2:04 PM | 🔄 | TUI action handler test updated to match new save action output format | ~165 |
14-
| #474 | 2:03 PM || TUI action handlers test simplified to three core test functions | ~156 |
15-
| #472 | " || TUI action handlers test imports corrected to import Action from keybindings module | ~134 |
16-
| #466 | 2:02 PM | 🟣 | TUI action handlers test suite created for settings, sync, and configuration | ~195 |
17-
| #458 | 2:01 PM | 🟣 | KeyHierarchy save/unlock implementation committed with complete key wrapping | ~202 |
18-
| #444 | 1:59 PM | 🟣 | KeyHierarchy integration test suite created with four test functions | ~199 |
19-
| #436 | 1:58 PM | 🟣 | CloudSyncService implementation committed to git repository | ~224 |
20-
| #433 | 1:56 PM || CloudService test imports fixed to correct module paths | ~127 |
21-
| #432 | " | 🟣 | CloudSyncService integration test suite created with four async test functions | ~198 |
22-
| #424 | 1:55 PM | 🟣 | CloudStorage implementation committed to git repository | ~189 |
23-
| #413 | 1:52 PM | 🔴 | CloudStorage test type mismatches fixed with PathBuf conversion | ~153 |
24-
| #404 | 1:51 PM | 🟣 | CloudStorage integration test suite created with six async test functions | ~242 |
25-
| #401 | " | 🟣 | Cloud metadata serialization implementation committed to git repository | ~182 |
26-
| #398 | 1:50 PM | 🔵 | Integration test file structure confirmed with four test functions | ~206 |
27-
| #395 | " || Metadata test file moved from cloud subdirectory to tests root | ~152 |
10+
| #1069 | 6:52 PM | 🟣 | Added tests for test_connection functionality | ~262 |
11+
| #1067 | " | 🔵 | Test file complete at line 261 | ~175 |
12+
| #1057 | 6:50 PM | 🔴 | Fixed tests to use public API instead of private fields | ~237 |
13+
| #1054 | " | 🔵 | End of test file reached | ~184 |
14+
| #1044 | 6:49 PM | 🔴 | Fixed SFTP config test to include root path field | ~161 |
15+
| #1037 | 6:48 PM | 🔴 | Fixed line 100 Region string literal error | ~165 |
16+
| #1035 | 6:47 PM | 🔴 | Fixed line 36 string literal error | ~172 |
17+
| #1029 | 6:46 PM | 🔴 | Fixed SFTP config test to include root path field | ~178 |
18+
| #1026 | " | 🔵 | Found existing provider config integration tests | ~289 |
19+
| #1021 | 6:44 PM | 🔴 | Fixed all SensitiveString access in passkey_test.rs | ~90 |
20+
| #1020 | " | 🔵 | Found SensitiveString access issues in passkey_test.rs | ~122 |
21+
| #1015 | " | 🔴 | Fixed SensitiveString access in onboarding_test.rs | ~186 |
22+
| #1014 | 6:43 PM | 🔴 | Fixed SensitiveString access in sync_integration_test.rs | ~90 |
23+
| #1009 | " | 🔴 | Fixing SensitiveString field access in sync_integration_test.rs | ~91 |
2824
</claude-mem-context>

tests/keystore_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ fn keystore_roundtrip_unlock() {
88

99
let keystore = KeyStore::initialize(&path, master).unwrap();
1010
assert!(path.exists());
11-
assert_eq!(keystore.dek.len(), 32);
11+
assert_eq!(keystore.dek.get().len(), 32);
1212

1313
let unlocked = KeyStore::unlock(&path, master).unwrap();
14-
assert_eq!(unlocked.dek.len(), 32);
14+
assert_eq!(unlocked.dek.get().len(), 32);
1515
}
1616

1717
#[test]

tests/onboarding_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ fn onboarding_initializes_keystore_file() {
99
assert!(!is_initialized(&path));
1010
let keystore = initialize_keystore(&path, "correct-horse-battery-staple").unwrap();
1111
assert!(path.exists());
12-
assert_eq!(keystore.dek.len(), 32);
12+
assert_eq!(keystore.dek.get().len(), 32);
1313
assert!(is_initialized(&path));
1414
}

tests/passkey_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn test_generate_passkey_24_words() {
1717
fn test_passkey_to_seed() {
1818
let passkey = Passkey::generate(24).unwrap();
1919
let seed = passkey.to_seed(None).unwrap();
20-
assert_eq!(seed.0.len(), 64); // BIP39 seed is 64 bytes
20+
assert_eq!(seed.get().len(), 64); // BIP39 seed is 64 bytes
2121
}
2222

2323
#[test]
@@ -27,8 +27,8 @@ fn test_passkey_from_words() {
2727

2828
let restored = Passkey::from_words(&words).unwrap();
2929
assert_eq!(
30-
original.to_seed(None).unwrap().0,
31-
restored.to_seed(None).unwrap().0
30+
original.to_seed(None).unwrap().get(),
31+
restored.to_seed(None).unwrap().get()
3232
);
3333
}
3434

@@ -39,5 +39,5 @@ fn test_passkey_with_optional_passphrase() {
3939
let seed_with_passphrase = passkey.to_seed(Some("test-passphrase")).unwrap();
4040

4141
// Different passphrases should produce different seeds
42-
assert_ne!(seed_no_passphrase.0, seed_with_passphrase.0);
42+
assert_ne!(seed_no_passphrase.get(), seed_with_passphrase.get());
4343
}

tests/sync_integration_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async fn test_full_sync_flow_with_passkey() {
3030

3131
// Step 2: Convert Passkey to seed
3232
let seed = passkey.to_seed(None).unwrap();
33-
assert_eq!(seed.0.len(), 64);
33+
assert_eq!(seed.get().len(), 64);
3434

3535
// Step 3: Derive root master key from Passkey seed
3636
let salt = [1u8; 16]; // In production, this would be a random salt

tests/sync_nonce_validator_test.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,26 @@ fn test_recovery_strategy_mismatch_nonce() {
3030
#[test]
3131
fn test_prompt_user_resolution_returns_strategy() {
3232
let validator = NonceValidator::new();
33-
let result = validator.prompt_user_resolution("test-record");
33+
let local_nonce = [1u8; 12];
34+
let remote_nonce = [2u8; 12];
35+
let result = validator.prompt_user_resolution(&local_nonce, &remote_nonce);
3436

35-
// Should return Some strategy (currently defaults to UseLocal)
36-
assert!(result.is_some());
37+
// Should return Ok strategy (currently defaults to UseLocal)
38+
assert!(result.is_ok());
3739
assert_eq!(result.unwrap(), RecoveryStrategy::UseLocal);
3840
}
3941

4042
#[test]
4143
fn test_prompt_user_resolution_different_record_names() {
4244
let validator = NonceValidator::new();
43-
44-
// Test with different record names
45-
for name in &["github", "gitlab", "aws", "database"] {
46-
let result = validator.prompt_user_resolution(name);
47-
assert!(result.is_some(), "Should return strategy for record: {}", name);
45+
let local_nonce = [1u8; 12];
46+
let remote_nonce = [2u8; 12];
47+
48+
// Test with different nonces
49+
for i in 0..4 {
50+
let local = [i; 12];
51+
let remote = [i + 1; 12];
52+
let result = validator.prompt_user_resolution(&local, &remote);
53+
assert!(result.is_ok(), "Should return strategy for nonces");
4854
}
4955
}

0 commit comments

Comments
 (0)