File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -141,3 +141,35 @@ pub enum ArweaveClientError {
141
141
#[ error( "Unknown error" ) ]
142
142
Unknown ( #[ from] reqwest:: Error ) ,
143
143
}
144
+
145
+ #[ cfg( test) ]
146
+ mod test {
147
+ use serde_derive:: Deserialize ;
148
+
149
+ use crate :: {
150
+ components:: link_resolver:: { ArweaveClient , ArweaveResolver } ,
151
+ data_source:: offchain:: Base64 ,
152
+ } ;
153
+
154
+ // This test ensures that passing txid/filename works when the txid refers to manifest.
155
+ // the actual data seems to have some binary header and footer so these ranges were found
156
+ // by inspecting the data with hexdump.
157
+ #[ tokio:: test]
158
+ async fn fetch_bundler_url ( ) {
159
+ let url = Base64 :: from ( "Rtdn3QWEzM88MPC2dpWyV5waO7Vuz3VwPl_usS2WoHM/DriveManifest.json" ) ;
160
+ #[ derive( Deserialize , Debug , PartialEq ) ]
161
+ struct Manifest {
162
+ pub manifest : String ,
163
+ }
164
+
165
+ let client = ArweaveClient :: default ( ) ;
166
+ let no_header = & client. get ( & url) . await . unwrap ( ) [ 1295 ..320078 ] ;
167
+ let content: Manifest = serde_json:: from_slice ( no_header) . unwrap ( ) ;
168
+ assert_eq ! (
169
+ content,
170
+ Manifest {
171
+ manifest: "arweave/paths" . to_string( ) ,
172
+ }
173
+ ) ;
174
+ }
175
+ }
You can’t perform that action at this time.
0 commit comments