Skip to content

Commit b42f754

Browse files
committed
fix tests
1 parent b2c8113 commit b42f754

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Cargo.lock

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

catalyst-toolbox/src/community_advisors/models/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ mod tests {
145145

146146
#[test]
147147
fn test_deserialize() {
148-
let file_path = PathBuf::from("./resources/testing/valid_assessments.csv");
148+
let file_path = PathBuf::from("../resources/testing/valid_assessments.csv");
149149
let data: Vec<AdvisorReviewRow> =
150150
csv_utils::load_data_from_csv::<_, b','>(&file_path).unwrap();
151151
assert_eq!(data.len(), 1);

snapshot-lib/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ pub mod tests {
183183
use chain_addr::{Discrimination, Kind};
184184
use jormungandr_lib::interfaces::{Address, InitialUTxO};
185185
use proptest::prelude::*;
186+
#[cfg(test)]
186187
use test_strategy::proptest;
187188

188189
struct DummyAssigner;
@@ -217,6 +218,7 @@ pub mod tests {
217218
}
218219
}
219220

221+
#[cfg(test)]
220222
#[proptest]
221223
fn test_threshold(raw: RawSnapshot, stake_threshold: u64, additional_reg: VotingRegistration) {
222224
let mut add = raw.clone();
@@ -260,6 +262,7 @@ pub mod tests {
260262
}
261263

262264
// Test all voting power is distributed among delegated keys
265+
#[cfg(test)]
263266
#[proptest]
264267
fn test_voting_power_all_distributed(reg: VotingRegistration) {
265268
let snapshot = Snapshot::from_raw_snapshot(
@@ -277,6 +280,7 @@ pub mod tests {
277280
assert_eq!(total_stake, u64::from(reg.voting_power))
278281
}
279282

283+
#[cfg(test)]
280284
#[proptest]
281285
fn test_non_catalyst_regs_are_ignored(mut reg: VotingRegistration) {
282286
reg.voting_purpose = 1;
@@ -298,6 +302,7 @@ pub mod tests {
298302
)
299303
}
300304

305+
#[cfg(test)]
301306
#[test]
302307
fn test_distribution() {
303308
let mut raw_snapshot = Vec::new();
@@ -340,6 +345,7 @@ pub mod tests {
340345
assert_eq!(vp_2 - vp_1, n / 2); // last key get the remainder during distribution
341346
}
342347

348+
#[cfg(test)]
343349
#[test]
344350
fn test_parsing() {
345351
let raw: RawSnapshot = serde_json::from_str(

snapshot-lib/src/registration.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ mod tests {
145145
use proptest::collection::vec;
146146
use proptest::prelude::*;
147147
use serde::{Serialize, Serializer};
148+
#[cfg(test)]
148149
use serde_test::{assert_de_tokens, Configure, Token};
150+
#[cfg(test)]
149151
use test_strategy::proptest;
150152

151153
impl Arbitrary for Delegations {
@@ -210,6 +212,7 @@ mod tests {
210212
}
211213
}
212214

215+
#[cfg(test)]
213216
#[test]
214217
fn parse_example() {
215218
assert_de_tokens(
@@ -276,6 +279,7 @@ mod tests {
276279
}
277280
}
278281

282+
#[cfg(test)]
279283
#[proptest]
280284
fn serde_json(d: Delegations) {
281285
assert_eq!(
@@ -284,6 +288,7 @@ mod tests {
284288
)
285289
}
286290

291+
#[cfg(test)]
287292
#[proptest]
288293
fn serde_yaml(d: Delegations) {
289294
assert_eq!(
@@ -292,16 +297,19 @@ mod tests {
292297
)
293298
}
294299

300+
#[cfg(test)]
295301
#[test]
296302
fn test_empty_delegations_are_rejected() {
297303
assert!(serde_json::from_str::<Delegations>(r#"[]"#,).is_err());
298304
}
299305

306+
#[cfg(test)]
300307
#[test]
301308
fn test_u64_weight_is_rejected() {
302309
assert!(serde_json::from_str::<Delegations>(r#"[["0xa6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d1663", 4294967296]]"#,).is_err());
303310
}
304311

312+
#[cfg(test)]
305313
#[test]
306314
fn test_legacy_delegation_is_ok() {
307315
assert!(serde_json::from_str::<Delegations>(
@@ -310,6 +318,7 @@ mod tests {
310318
.is_ok());
311319
}
312320

321+
#[cfg(test)]
313322
#[test]
314323
fn test_u32_weight_is_ok() {
315324
serde_json::from_str::<Delegations>(

0 commit comments

Comments
 (0)