Skip to content

Commit e2218fe

Browse files
authored
test: Add test for EncryptedTokenStorage::new (googleworkspace#17)
1 parent f7c3ff3 commit e2218fe

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@googleworkspace/cli": patch
3+
---
4+
5+
Added test coverage for `EncryptedTokenStorage::new` initialization.

src/token_storage.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,20 @@ impl TokenStorage for EncryptedTokenStorage {
132132
None
133133
}
134134
}
135+
136+
#[cfg(test)]
137+
mod tests {
138+
use super::*;
139+
use std::path::PathBuf;
140+
141+
#[tokio::test]
142+
async fn test_encrypted_token_storage_new() {
143+
let path = PathBuf::from("/fake/path/to/token.json");
144+
let storage = EncryptedTokenStorage::new(path.clone());
145+
146+
assert_eq!(storage.file_path, path);
147+
148+
let cache_lock = storage.cache.lock().await;
149+
assert!(cache_lock.is_none());
150+
}
151+
}

0 commit comments

Comments
 (0)