Skip to content

Commit 8f6f018

Browse files
author
Zoran Cvetkov
committed
fix entity_cache tests
1 parent 3401f68 commit 8f6f018

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

store/test-store/tests/graph/entity_cache.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,8 @@ fn check_for_insert_async_store() {
591591
run_store_test(|mut cache, store, deployment, _writable| async move {
592592
let account_id = ACCOUNT_TYPE.parse_id("2").unwrap();
593593
// insert a new wallet
594-
let wallet_entity_5 = create_wallet_operation("5", &account_id, 79_i32, 2);
595-
let wallet_entity_6 = create_wallet_operation("6", &account_id, 200_i32, 3);
594+
let wallet_entity_5 = create_wallet_operation("5", &account_id, 79_i32, 12);
595+
let wallet_entity_6 = create_wallet_operation("6", &account_id, 200_i32, 13);
596596

597597
transact_entity_operations(
598598
&store,
@@ -609,12 +609,12 @@ fn check_for_insert_async_store() {
609609
causality_region: CausalityRegion::ONCHAIN,
610610
};
611611
let result = cache.load_related(&request).unwrap();
612-
let wallet_1 = create_wallet_entity("4", &account_id, 32_i32, 1);
613-
let wallet_2 = create_wallet_entity("5", &account_id, 79_i32, 2);
614-
let wallet_3 = create_wallet_entity("6", &account_id, 200_i32, 3);
612+
let wallet_1 = create_wallet_entity("4", &account_id, 32_i32, 21);
613+
let wallet_2 = create_wallet_entity("5", &account_id, 79_i32, 22);
614+
let wallet_3 = create_wallet_entity("6", &account_id, 200_i32, 23);
615615
let expeted_vec = vec![wallet_1, wallet_2, wallet_3];
616616

617-
assert_eq!(result, filter_vid(expeted_vec));
617+
assert_eq!(filter_vid(result), filter_vid(expeted_vec));
618618
});
619619
}
620620

@@ -656,7 +656,7 @@ fn check_for_update_async_related() {
656656
run_store_test(|mut cache, store, deployment, writable| async move {
657657
let entity_key = WALLET_TYPE.parse_key("1").unwrap();
658658
let account_id = entity_key.entity_id.clone();
659-
let wallet_entity_update = create_wallet_operation("1", &account_id, 79_i32, 1);
659+
let wallet_entity_update = create_wallet_operation("1", &account_id, 79_i32, 11);
660660

661661
let new_data = match wallet_entity_update {
662662
EntityOperation::Set { ref data, .. } => data.clone(),
@@ -680,8 +680,8 @@ fn check_for_update_async_related() {
680680
causality_region: CausalityRegion::ONCHAIN,
681681
};
682682
let result = cache.load_related(&request).unwrap();
683-
let wallet_2 = create_wallet_entity("2", &account_id, 92_i32, 2);
684-
let wallet_3 = create_wallet_entity("3", &account_id, 192_i32, 3);
683+
let wallet_2 = create_wallet_entity("2", &account_id, 92_i32, 12);
684+
let wallet_3 = create_wallet_entity("3", &account_id, 192_i32, 13);
685685
let expeted_vec = vec![new_data, wallet_2, wallet_3];
686686

687687
assert_eq!(filter_vid(result), filter_vid(expeted_vec));
@@ -743,7 +743,10 @@ fn scoped_get() {
743743
let act1 = cache.get(&key1, GetScope::InBlock).unwrap();
744744
assert_eq!(None, act1);
745745
let act1 = cache.get(&key1, GetScope::Store).unwrap();
746-
assert_eq!(Some(&wallet1), act1.as_ref().map(|e| e.as_ref()));
746+
assert_eq!(
747+
filter_vid(vec![wallet1.clone()]),
748+
vec![act1.as_ref().map(|e| e.as_ref()).unwrap().clone()]
749+
);
747750
// Even after reading from the store, the entity is not visible with
748751
// `InBlock`
749752
let act1 = cache.get(&key1, GetScope::InBlock).unwrap();

0 commit comments

Comments
 (0)