shuffle things around
This commit is contained in:
parent
d79e50e48f
commit
14242a8e37
8 changed files with 49 additions and 6 deletions
0
src/inbound/admin_ui/mod.rs
Normal file
0
src/inbound/admin_ui/mod.rs
Normal file
|
@ -1,2 +1,5 @@
|
|||
#[cfg(any(feature = "web", feature = "server"))]
|
||||
pub mod renderer;
|
||||
|
||||
#[cfg(any(feature = "web", feature = "server"))]
|
||||
pub mod admin_ui;
|
||||
|
|
|
@ -190,6 +190,8 @@ pub fn Post(page: String, id: String) -> Element {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use mockall::predicate;
|
||||
|
||||
use crate::{
|
||||
domain::entities,
|
||||
outbound::services::site::{MockSiteService, SiteServiceProvider},
|
||||
|
@ -227,7 +229,7 @@ mod tests {
|
|||
fn single_gets_page_info() {
|
||||
let mut app = VirtualDom::new(|| {
|
||||
rsx! {
|
||||
Single { page: "test".to_string() }
|
||||
Single { page: "pagename".to_string() }
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -237,6 +239,7 @@ mod tests {
|
|||
mock_service
|
||||
.expect_get_page()
|
||||
.times(1)
|
||||
.with(predicate::eq("test"), predicate::eq("pagename"))
|
||||
.returning(move |_, _| {
|
||||
Box::pin(async {
|
||||
Ok(entities::site::Page {
|
||||
|
@ -263,4 +266,41 @@ mod tests {
|
|||
assert!(elem_str.contains("Test page name"));
|
||||
assert!(elem_str.contains("test content"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn home_gets_page_info() {
|
||||
let mut app = VirtualDom::new(|| {
|
||||
rsx! {
|
||||
Home {}
|
||||
}
|
||||
});
|
||||
|
||||
testing::add_test_site_context(&mut app);
|
||||
|
||||
let mut mock_service = MockSiteService::new();
|
||||
mock_service
|
||||
.expect_get_page()
|
||||
.times(1)
|
||||
.with(predicate::eq("test"), predicate::eq("/"))
|
||||
.returning(move |_, _| {
|
||||
Box::pin(async {
|
||||
Ok(entities::site::Page {
|
||||
info: entities::site::PageInfo {
|
||||
title: "Test page name".to_string(),
|
||||
name: "test".to_string(),
|
||||
order: 0,
|
||||
},
|
||||
content: PageContent::Single {
|
||||
content: entities::site::Post { blocks: vec![] },
|
||||
},
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
server_context().insert(SiteServiceProvider::with(mock_service));
|
||||
|
||||
app.rebuild_in_place();
|
||||
let elem_str = dioxus::ssr::render(&app);
|
||||
assert!(elem_str.contains("Test page name"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ use dioxus_logger::tracing::Level;
|
|||
|
||||
mod domain;
|
||||
mod inbound;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
mod outbound;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#[cfg(feature = "server")]
|
||||
pub mod repository;
|
||||
|
||||
pub mod services;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#[cfg(feature = "server")]
|
||||
pub mod memory;
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
pub mod site;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod adapters;
|
||||
pub mod site;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#[cfg(feature = "server")]
|
||||
pub mod site;
|
||||
|
|
Loading…
Add table
Reference in a new issue