Skip to content

Commit

Permalink
feature flag tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CathLass committed Dec 9, 2024
1 parent 900b7cb commit db52644
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

@if (FeatureProvider.IsEnabled(FeatureNames.Induction))
{
<li class="moj-sub-navigation__item">
<li class="moj-sub-navigation__item" data-testid="induction-tab">
<a class="moj-sub-navigation__link" aria-current="@(selectedTab == PersonSubNavigationTab.Induction ? "page" : null)" href="@LinkGenerator.PersonInduction(personId)">Induction</a>
</li>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,30 @@ public class InductionTests(HostFixture hostFixture) : TestBase(hostFixture)
[Fact]
public async Task Get_FeatureFlagOff_NoInductionTabShown()
{
// Arrange
FeatureProvider.Features.Clear();
throw new NotImplementedException();
var person = await TestData.CreatePersonAsync();

// Act
var response = await HttpClient.GetAsync($"/persons/{person.ContactId}");

// Assert
var doc = await AssertEx.HtmlResponseAsync(response);
Assert.Null(doc.GetElementByTestId("induction-tab"));
}

[Fact]
public async Task Get_FeatureFlagOn_InductionTabShown()
{
// Arrange
var person = await TestData.CreatePersonAsync();

// Act
var response = await HttpClient.GetAsync($"/persons/{person.ContactId}");

// Assert
var doc = await AssertEx.HtmlResponseAsync(response);
Assert.NotNull(doc.GetElementByTestId("induction-tab"));
}

[Fact]
Expand Down

0 comments on commit db52644

Please sign in to comment.