1#![doc = include_str!("../README.md")]
2
3use rust_embed::Embed;
4
5#[derive(Embed)]
10#[folder = "built_assets"]
11pub struct PotreeAssets;
12
13#[cfg(test)]
14mod potree_assets_tests {
15 use super::*;
16
17 #[test]
18 fn should_return_the_correct_asset() {
19 let asset = PotreeAssets::get("build/potree/potree.js");
21
22 assert!(asset.is_some());
24 assert_eq!(
25 asset.unwrap().metadata.sha256_hash(),
26 [
27 233, 119, 224, 43, 52, 46, 99, 100, 218, 253, 246, 139, 172, 68, 39, 198, 242, 64,
28 255, 127, 185, 52, 69, 21, 38, 118, 221, 238, 4, 116, 172, 95
29 ]
30 );
31 }
32
33 #[test]
34 fn should_return_none_for_non_existent_asset() {
35 let asset = PotreeAssets::get("build/no/asset.txt");
37
38 assert!(asset.is_none());
40 }
41
42 #[test]
43 fn should_return_the_binary_decoder_worker() {
44 let asset = PotreeAssets::get("build/potree/workers/BinaryDecoderWorker.js");
46
47 assert!(asset.is_some());
49 }
50}