Skip to content

Commit 48af6ae

Browse files
committed
Add rmvote to test
1 parent c95f0c4 commit 48af6ae

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

flake.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.

tests/src/posts/posts/post.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ test('get_all_posts_sorted_by_votes sorts by number of votes desc, then timestam
334334
});
335335

336336
await pause(2000);
337+
338+
337339

338340
// All agents see the same post ordering
339341
const alice_posts_sorted = await alice.namedCells.get('herd').callZome({
@@ -359,6 +361,23 @@ test('get_all_posts_sorted_by_votes sorts by number of votes desc, then timestam
359361
fn_name: "get_all_posts_sorted_by_votes",
360362
});
361363
t.deepEqual(john_posts_sorted, [record.signed_action.hashed.hash, record3.signed_action.hashed.hash, record2.signed_action.hashed.hash])
364+
365+
// Bob removes his vote to alice's post
366+
await bob.namedCells.get('herd').callZome({
367+
zome_name: "posts",
368+
fn_name: "rmvote_post",
369+
payload: record.signed_action.hashed.hash,
370+
});
371+
372+
await pause(2000);
373+
374+
const metadata: Record = await alice.namedCells.get('herd').callZome({
375+
zome_name: "posts",
376+
fn_name: "get_post_metadata",
377+
payload: record.signed_action.hashed.hash,
378+
});
379+
380+
t.deepEqual(3, (decode((metadata.entry as any).Present.entry) as any).upvotes);
362381

363382
},
364383
true,

0 commit comments

Comments
 (0)