File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ pub async fn expense_item(
2323/// Retrieves all Ruddr Expense Item objects, and deserializes it to the corresponding vector of model structs.
2424/// https://ruddr.readme.io/reference/list-expense-items
2525/// ```ignore
26- /// let expense_reports = expense_reports (&client).await?;
26+ /// let expense_items = expense_items (&client, Some(types::UUID::from("2bdab00d-86fb-46dc-ae05-7cc9c4aedc80")) ).await?;
2727/// ```
2828pub async fn expense_items (
2929 client : & client:: Client ,
@@ -42,3 +42,6 @@ pub async fn expense_items(
4242 . read :: < expense_item:: ExpenseItems > ( "expense-items" , & params)
4343 . await ?)
4444}
45+
46+ #[ cfg( test) ]
47+ mod tests;
Original file line number Diff line number Diff line change 1+ use super :: * ;
2+
3+ #[ test]
4+ fn test_expense_item ( ) {
5+ let test = async {
6+ let client = client:: Client :: new ( Some ( "abcdefghi123456789" ) )
7+ . expect ( "client with token could not be constructed" ) ;
8+ assert_eq ! (
9+ expense_item(
10+ & client,
11+ types:: UUID :: from( "77f5ccdc-4226-4ff1-877e-5644d0a04522" )
12+ )
13+ . await
14+ . unwrap_err( )
15+ . to_string( ) ,
16+ "client read response failed" ,
17+ "expense_item retrieval did not fail on auth" ,
18+ )
19+ } ;
20+ let rt = tokio:: runtime:: Runtime :: new ( ) . unwrap ( ) ;
21+ rt. block_on ( test) ;
22+ }
23+
24+ #[ test]
25+ fn test_expense_items ( ) {
26+ let test = async {
27+ let client = client:: Client :: new ( Some ( "abcdefghi123456789" ) )
28+ . expect ( "client with token could not be constructed" ) ;
29+ assert_eq ! (
30+ expense_items(
31+ & client,
32+ Some ( types:: UUID :: from( "2bdab00d-86fb-46dc-ae05-7cc9c4aedc80" ) )
33+ )
34+ . await
35+ . unwrap_err( )
36+ . to_string( ) ,
37+ "client read response failed" ,
38+ "expense_items retrieval did not fail on auth" ,
39+ )
40+ } ;
41+ let rt = tokio:: runtime:: Runtime :: new ( ) . unwrap ( ) ;
42+ rt. block_on ( test) ;
43+ }
You can’t perform that action at this time.
0 commit comments