Skip to content

Commit

Permalink
Test that rejected proposals are proposals in cache and not in commit…
Browse files Browse the repository at this point in the history
… when receiving commit

The test currently fails and the implementation will be fixed in the
next commit.
  • Loading branch information
stefunctional committed Jan 24, 2024
1 parent d9d9e2e commit 63b454c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mls-rs/src/group/proposal_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4172,4 +4172,31 @@ mod tests {
leaf_node: update_leaf_node(name, leaf_index).await,
}
}

#[maybe_async::test(not(mls_build_async), async(mls_build_async, crate::futures_test))]
async fn when_receiving_commit_unused_proposals_are_proposals_in_cache_but_not_in_commit() {
let (alice, tree) = new_tree("alice").await;

let proposal = Proposal::GroupContextExtensions(Default::default());
let proposal_ref = make_proposal_ref(&proposal, alice).await;

let state = CommitReceiver::new(
&tree,
alice,
alice,
test_cipher_suite_provider(TEST_CIPHER_SUITE),
)
.cache(proposal_ref.clone(), proposal, alice)
.receive([Proposal::Add(Box::new(AddProposal {
key_package: test_key_package(TEST_PROTOCOL_VERSION, TEST_CIPHER_SUITE, "bob"),
}))])
.await
.unwrap();

let [p] = &state.rejected_proposals[..] else {
panic!("Expected single rejected proposal");
};

assert_eq!(p.proposal_ref(), Some(&proposal_ref));
}
}

0 comments on commit 63b454c

Please sign in to comment.