Skip to content

Commit ecdc970

Browse files
authored
Expand Tests and remove some redundant clone's (#617)
* fix(errors): make error msesages consisten with each other * test(rate-limit-service): add tests * test(balance-service): add tests to balance service * test(max-packet-service): add tests to max packet amount service * test(redis): make redis tests more clear and verbose * fix(redis): remove a bunch of redundant clone operations
1 parent 96c187d commit ecdc970

File tree

18 files changed

+1014
-364
lines changed

18 files changed

+1014
-364
lines changed

Cargo.lock

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/interledger-api/src/routes/accounts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ where
6565
+ Sync
6666
+ 'static,
6767
{
68-
// TODO can we make any of the Filters const or put them in lazy_static?
68+
// TODO can we make any of the Filters const or put them in once_cell?
6969
let with_store = warp::any().map(move || store.clone()).boxed();
7070
let with_incoming_handler = warp::any().map(move || incoming_handler.clone()).boxed();
7171

crates/interledger-errors/src/account_store_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use thiserror::Error;
99
pub enum AccountStoreError {
1010
#[error("{0}")]
1111
Other(#[from] Box<dyn StdError + Send + 'static>),
12-
#[error("account with username/id `{0}` was not found")]
12+
#[error("account `{0}` was not found")]
1313
AccountNotFound(String),
14-
#[error("account with id `{0}` already exists")]
14+
#[error("account `{0}` already exists")]
1515
AccountExists(String),
1616
#[error("wrong account length (expected {expected}, got {actual})")]
1717
WrongLength { expected: usize, actual: usize },

crates/interledger-errors/src/btp_store_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use thiserror::Error;
88
pub enum BtpStoreError {
99
#[error("{0}")]
1010
Other(#[from] Box<dyn StdError + Send + 'static>),
11-
#[error("account with username/id `{0}` was not found")]
11+
#[error("account `{0}` was not found")]
1212
AccountNotFound(String),
13-
#[error("account with id `{0}` is not authorized for this action")]
13+
#[error("account `{0}` is not authorized for this action")]
1414
Unauthorized(String),
1515
}
1616

crates/interledger-errors/src/create_account_error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ pub enum CreateAccountError {
1616
InvalidHttpUrl(UrlParseError),
1717
#[error("the provided btp url is not valid: {0}")]
1818
InvalidBtpUrl(UrlParseError),
19-
#[error("the provided routing relation not valid: {0}")]
19+
#[error("the provided routing relation is not valid: {0}")]
2020
InvalidRoutingRelation(String),
21+
#[error("the provided value for parameter `{0}` was too large")]
22+
ParamTooLarge(String),
2123
}
2224

2325
impl From<CreateAccountError> for ApiError {

crates/interledger-errors/src/http_store_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use thiserror::Error;
88
pub enum HttpStoreError {
99
#[error("{0}")]
1010
Other(#[from] Box<dyn StdError + Send + 'static>),
11-
#[error("account with username/id `{0}` was not found")]
11+
#[error("account `{0}` was not found")]
1212
AccountNotFound(String),
13-
#[error("account with id `{0}` is not authorized for this action")]
13+
#[error("account `{0}` is not authorized for this action")]
1414
Unauthorized(String),
1515
}
1616

crates/interledger-errors/src/node_store_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pub enum NodeStoreError {
1111
Other(#[from] Box<dyn StdError + Send + 'static>),
1212
#[error("Settlement engine URL loaded was not a valid url: {0}")]
1313
InvalidEngineUrl(String),
14-
#[error("account with username/id `{0}` was not found")]
14+
#[error("account `{0}` was not found")]
1515
AccountNotFound(String),
16-
#[error("account with id `{0}` already exists")]
16+
#[error("account `{0}` already exists")]
1717
AccountExists(String),
1818
#[error("not all of the given accounts exist")]
1919
MissingAccounts,

crates/interledger-service-util/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ uuid = "0.8.1"
3030
[dev-dependencies]
3131
uuid = { version = "0.8.1", default-features = false}
3232
bytes04 = { package = "bytes", version = "0.4", default-features = false }
33+
once_cell = "1.3.1"
34+
parking_lot = "0.10.0"
35+
mockito = "0.23.0"
36+
url = "2.1.0"

0 commit comments

Comments
 (0)