mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 03:56:44 +08:00
feat: track official versions and import resources
Persist official version-state, extend CAS/ResourceRepository import classification, and add offline catalog and failure regression fixtures. Fixes #13 Fixes #12 Fixes #8
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
use bat_adapters::manifest::ManifestDriverRegistry;
|
||||
use bat_core::domain::ResourceType;
|
||||
|
||||
#[tokio::test]
|
||||
async fn parses_current_catalog_fixture_with_resource_categories() {
|
||||
let manifest = ManifestDriverRegistry::with_defaults()
|
||||
.parse(include_bytes!(
|
||||
"fixtures/addressables_regression/current_catalog.json"
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(manifest.resources.len(), 4);
|
||||
assert_eq!(
|
||||
manifest.resources[0].resource_type,
|
||||
ResourceType::TableBundle
|
||||
);
|
||||
assert_eq!(manifest.resources[1].resource_type, ResourceType::Media);
|
||||
assert_eq!(manifest.resources[2].resource_type, ResourceType::TextAsset);
|
||||
assert_eq!(
|
||||
manifest.resources[3].dependencies,
|
||||
vec!["shared_dependencies.bundle".to_string()]
|
||||
);
|
||||
assert_eq!(
|
||||
manifest.metadata.cdn_prefixes,
|
||||
vec!["https://fixture.invalid/current/".to_string()]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn parses_previous_catalog_fixture_using_internal_ids() {
|
||||
let manifest = ManifestDriverRegistry::with_defaults()
|
||||
.parse(include_bytes!(
|
||||
"fixtures/addressables_regression/previous_catalog.json"
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(manifest.resources.len(), 3);
|
||||
assert_eq!(
|
||||
manifest.resources[0].resource_type,
|
||||
ResourceType::AssetBundle
|
||||
);
|
||||
assert_eq!(manifest.resources[1].resource_type, ResourceType::Manifest);
|
||||
assert_eq!(
|
||||
manifest.resources[2].resource_type,
|
||||
ResourceType::TableBundle
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn parses_catalog_structure_change_with_alias_fields() {
|
||||
let manifest = ManifestDriverRegistry::with_defaults()
|
||||
.parse(include_bytes!(
|
||||
"fixtures/addressables_regression/structure_changed_catalog.json"
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(manifest.resources.len(), 2);
|
||||
assert_eq!(manifest.resources[0].resource_type, ResourceType::Media);
|
||||
assert_eq!(
|
||||
manifest.resources[0].dependencies,
|
||||
vec!["shared_assets_current.bundle".to_string()]
|
||||
);
|
||||
assert_eq!(manifest.resources[1].resource_type, ResourceType::TextAsset);
|
||||
assert_eq!(manifest.resources[1].address.as_deref(), Some("lesson"));
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"m_LocatorId": "AddressablesMainContentCatalog",
|
||||
"m_InternalIdPrefixes": [
|
||||
"https://fixture.invalid/current/"
|
||||
],
|
||||
"m_Entries": [
|
||||
{
|
||||
"internal_id": "TableBundles/ExcelDB.db",
|
||||
"hash": "current-table-hash",
|
||||
"size": 4096,
|
||||
"address": "ExcelDB",
|
||||
"dependencies": []
|
||||
},
|
||||
{
|
||||
"internal_id": "MediaResources-Windows/voice/title.acb",
|
||||
"hash": "current-media-hash",
|
||||
"size": 2048,
|
||||
"address": "title",
|
||||
"dependencies": []
|
||||
},
|
||||
{
|
||||
"internal_id": "TextAssets/dialogue.csv",
|
||||
"hash": "current-text-hash",
|
||||
"size": 128,
|
||||
"address": "dialogue",
|
||||
"dependencies": []
|
||||
},
|
||||
{
|
||||
"internal_id": "shared_assets_current.bundle",
|
||||
"hash": "current-bundle-hash",
|
||||
"size": 8192,
|
||||
"address": "shared_assets_current",
|
||||
"dependencies": [
|
||||
"shared_dependencies.bundle"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"m_LocatorId": "AddressablesMainContentCatalog",
|
||||
"m_InternalIdPrefixes": [],
|
||||
"m_InternalIds": [
|
||||
"shared_assets_previous.bundle",
|
||||
"catalog_previous.json",
|
||||
"TableBundles/ExcelDB.db"
|
||||
]
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"m_LocatorId": "AddressablesMainContentCatalog",
|
||||
"m_InternalIdPrefixes": [],
|
||||
"m_InternalIds": [
|
||||
"fallback.bundle"
|
||||
],
|
||||
"m_Entries": [
|
||||
{
|
||||
"InternalId": "MediaResources-Android/voice/title.awb",
|
||||
"Hash": "changed-media-hash",
|
||||
"Size": 65536,
|
||||
"Address": "title-android",
|
||||
"m_Dependencies": [
|
||||
"shared_assets_current.bundle"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Path": "TextAssets/lesson.json",
|
||||
"Hash": "changed-text-hash",
|
||||
"Size": 512,
|
||||
"Key": "lesson"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user