mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix tests
This commit is contained in:
@@ -166,17 +166,27 @@ impl Scope {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tauri_utils::namespace::MemberResolution;
|
||||
|
||||
use super::RemoteDomainAccessScope;
|
||||
use crate::{
|
||||
api::ipc::CallbackFn,
|
||||
test::{assert_ipc_response, mock_app, MockRuntime},
|
||||
test::{assert_ipc_response, mock_builder, mock_context, noop_assets, MockRuntime},
|
||||
App, InvokePayload, Manager, Window, WindowBuilder,
|
||||
};
|
||||
|
||||
const PLUGIN_NAME: &str = "test";
|
||||
|
||||
fn test_context(scopes: Vec<RemoteDomainAccessScope>) -> (App<MockRuntime>, Window<MockRuntime>) {
|
||||
let app = mock_app();
|
||||
let mut context = mock_context(noop_assets());
|
||||
context.runtime_authority.add_member(MemberResolution {
|
||||
member: "main".into(),
|
||||
commands: vec![
|
||||
"plugin:path|is_absolute".into(),
|
||||
format!("plugin:{PLUGIN_NAME}|doSomething"),
|
||||
],
|
||||
});
|
||||
let app = mock_builder().build(context).unwrap();
|
||||
let window = WindowBuilder::new(&app, "main", Default::default())
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
@@ -132,6 +132,7 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
|
||||
},
|
||||
build: Default::default(),
|
||||
plugins: Default::default(),
|
||||
namespaces: Default::default(),
|
||||
},
|
||||
assets: Arc::new(assets),
|
||||
default_window_icon: None,
|
||||
@@ -147,6 +148,7 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
|
||||
},
|
||||
_info_plist: (),
|
||||
pattern: Pattern::Brownfield(std::marker::PhantomData),
|
||||
runtime_authority: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user