Skip to content

Commit

Permalink
Add unit test for new clearProposedFederation method
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Oct 23, 2024
1 parent c2688c4 commit bc59eea
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,28 @@ void clearRetiredFederation_whenHavingOldFederation_removesOldFederation() {
assertThat(oldFederation, is(nullValue()));
}

@Test
@Tag("clear proposed federation")
void clearProposedFederation_removesProposedFederation() {
// arrange
ActivationConfig.ForBlock activations = ActivationConfigsForTest.all().forBlock(0);

ErpFederation federation = P2shErpFederationBuilder.builder().build();
storageProvider.setProposedFederation(federation);

// first check the proposed federation was correctly saved
Optional<Federation> proposedFederation = storageProvider.getProposedFederation(federationMainnetConstants, activations);
assertTrue(proposedFederation.isPresent());
assertThat(proposedFederation.get(), is(federation));

// act
federationSupport.clearProposedFederation();

// assert
Optional<Federation> currentProposedFederation = storageProvider.getProposedFederation(federationMainnetConstants, activations);
assertFalse(currentProposedFederation.isPresent());
}

@Test
@Tag("save")
void save_callsStorageProviderSave() {
Expand Down

0 comments on commit bc59eea

Please sign in to comment.