use sdk_storage::{StorageService, unix_to_system_time}; use tempfile::TempDir; #[async_std::test] async fn store_and_retrieve_hex_in_tempdir() { let td = TempDir::new().unwrap(); let dir_path = td.path().to_string_lossy().to_string(); let svc = StorageService::new(dir_path); let key = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; let value = b"hello"; let expires = Some(unix_to_system_time(60 + sdk_storage::system_time_to_unix(std::time::SystemTime::now()))); svc.store_data(key, value, expires).await.unwrap(); let got = svc.retrieve_data(key).await.unwrap(); assert_eq!(got, value); }