pub struct TestApp {
pub router: Router,
pub state: AppState,
}Expand description
Harness pengujian in-memory Lumina Framework
Fields§
§router: Router§state: AppStateImplementations§
Source§impl TestApp
impl TestApp
Sourcepub fn req(&self, method: &str, uri: &str) -> TestRequestBuilder
pub fn req(&self, method: &str, uri: &str) -> TestRequestBuilder
Buat request builder fluen untuk kustomisasi method, header, body, dan token
pub fn get_req(&self, uri: &str) -> TestRequestBuilder
pub fn post_req(&self, uri: &str) -> TestRequestBuilder
pub fn put_req(&self, uri: &str) -> TestRequestBuilder
pub fn patch_req(&self, uri: &str) -> TestRequestBuilder
pub fn delete_req(&self, uri: &str) -> TestRequestBuilder
Sourcepub async fn get(&self, uri: &str) -> TestResponse
pub async fn get(&self, uri: &str) -> TestResponse
Shorthand request langsung (Backward Compatible)
pub async fn post(&self, uri: &str, body: Value) -> TestResponse
pub async fn put(&self, uri: &str, body: Value) -> TestResponse
pub async fn delete(&self, uri: &str) -> TestResponse
Sourcepub async fn assert_database_has(
&self,
table: &str,
criteria: Value,
) -> &TestApp
pub async fn assert_database_has( &self, table: &str, criteria: Value, ) -> &TestApp
Pastikan data tertentu ada di dalam tabel database.
Contoh:
ⓘ
app.assert_database_has("contacts", json!({ "name": "Budi Santoso", "is_active": 1 })).await;Sourcepub async fn assert_database_missing(
&self,
table: &str,
criteria: Value,
) -> &TestApp
pub async fn assert_database_missing( &self, table: &str, criteria: Value, ) -> &TestApp
Pastikan data tertentu TIDAK ada di dalam tabel database.
Sourcepub async fn assert_database_count(
&self,
table: &str,
expected_count: usize,
) -> &TestApp
pub async fn assert_database_count( &self, table: &str, expected_count: usize, ) -> &TestApp
Pastikan jumlah total baris pada tabel sesuai dengan ekspektasi.
Auto Trait Implementations§
impl !RefUnwindSafe for TestApp
impl !UnwindSafe for TestApp
impl Forget for TestApp
impl Freeze for TestApp
impl Move for TestApp
impl Send for TestApp
impl Sync for TestApp
impl Unpin for TestApp
impl UnsafeUnpin for TestApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more