Skip to content

Commit 39d6b29

Browse files
author
Zoran Cvetkov
committed
cleanup
1 parent 3d9e05f commit 39d6b29

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

graph/src/data/store/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,12 @@ impl Entity {
913913
Id::try_from(self.get("id").unwrap().clone()).expect("the id is set to a valid value")
914914
}
915915

916-
// TODO: only for tests!
916+
/// Convenience methods to modify individual attributes for tests.
917+
/// Production code should not use/need this.
918+
#[cfg(debug_assertions)]
917919
pub fn vid(&self) -> i64 {
918920
self.get("vid")
919-
.expect("the vid is set")
921+
.unwrap_or(&Value::Int8(0))
920922
.as_int8()
921923
.expect("the vid is set to a valid value")
922924
}

store/test-store/tests/core/interfaces.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,11 +1114,11 @@ async fn enums() {
11141114
let entities = vec![
11151115
(
11161116
"Trajectory",
1117-
entity! { schema => id: "1", direction: "EAST", meters: 10, vid: 0i64},
1117+
entity! { schema => id: "1", direction: "EAST", meters: 10, vid: 0i64 },
11181118
),
11191119
(
11201120
"Trajectory",
1121-
entity! { schema => id: "2", direction: "NORTH", meters: 15, vid: 1i64},
1121+
entity! { schema => id: "2", direction: "NORTH", meters: 15, vid: 1i64 },
11221122
),
11231123
];
11241124
let query = "query { trajectories { id, direction, meters } }";
@@ -1365,11 +1365,11 @@ async fn derived_interface_bytes() {
13651365
("Pool", entity! { schema => id: b("0xf001"), vid: 0i64 }),
13661366
(
13671367
"Sell",
1368-
entity! { schema => id: b("0xc0"), pool: "0xf001", vid: 0i64},
1368+
entity! { schema => id: b("0xc0"), pool: "0xf001", vid: 0i64 },
13691369
),
13701370
(
13711371
"Buy",
1372-
entity! { schema => id: b("0xb0"), pool: "0xf001", vid: 0i64},
1372+
entity! { schema => id: b("0xb0"), pool: "0xf001", vid: 0i64 },
13731373
),
13741374
];
13751375

0 commit comments

Comments
 (0)