Available on crate feature
test-support only.Expand description
Mock Thunderstore server, package index, and archives for tests. A mock Thunderstore for tests: an HTTP server that serves a small package index and real package archives, so the install pipeline runs end to end with no network access.
The index has five packages, each downloaded from /dl/<archive>.zip:
Owner-ModAandOwner-ModB1.0.0, with no dependencies.Owner-ModC1.0.0, which depends onOwner-ModA-1.0.0.Owner-ModDat 1.0.0 and a newer 2.0.0, fromModD-1.0.0.zipandModD-2.0.0.zip.denikson-BepInExPack_Valheim5.4.2200, a real mod-loader identifier whose archive is shaped byloader_zip.
Each mod archive ships a DLL named after its package (ModA.dll), so a test
can tell whose files landed where.
Every version has a readme except Owner-ModB, which answers 404 like
a package Thunderstore has no readme for.
use thunderstore_engine::test_support::MockThunderstore;
let mock = MockThunderstore::start_async().await;
let client = mock.client_builder().cache_dir("/tmp/cache").build()?;
let index = client.get_manifest().await?;
assert_eq!(index.len(), 5);Re-exports§
pub use mockito;
Structs§
- Mock
Thunderstore - A running mock Thunderstore serving
index_jsonand every archive it names.
Constants§
- PACKAGE_
INDEX_ PATH - Path the package index is served from.
Functions§
- index_
json - The package index described in the module docs, with every
download URL under
server_url. - loader_
zip - A mod-loader archive shaped like
denikson-BepInExPack_Valheim: its payload sits under therootFolderthe bundled ecosystem names for that package, so an install strips the wrapper and the files land at the target root. - mod_zip
- A mod archive with a manifest at
versionand one DLL,plugins/ModA.dll, which the install rules route toBepInEx/plugins/<Owner-Name>/. - mod_
zip_ with mod_zipwith the DLL nameddll_name.- readme
- The readme markdown the mock serves for
nameatversion, such as"# ModA 1.0.0\n\nA mod.". - readme_
path - Path a version’s readme is served from, as Thunderstore lays it out.