mirror of
https://github.com/bitwarden/server.git
synced 2025-05-01 09:42:19 -05:00
form validation
This commit is contained in:
parent
fd6cf1171c
commit
7ca5898ae3
@ -10,6 +10,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
|
<PackageReference Include="NSubstitute" Version="5.1.0" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio"
|
<PackageReference Include="xunit.runner.visualstudio"
|
||||||
Version="$(XUnitRunnerVisualStudioVersion)">
|
Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
using Bit.Admin.AdminConsole.Components.Pages.Organizations;
|
||||||
|
using Bit.Core.Repositories;
|
||||||
|
using Bit.Core.Settings;
|
||||||
|
using Bunit;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NSubstitute;
|
||||||
|
|
||||||
|
namespace Admin.Test.AdminConsole.Components.Pages;
|
||||||
|
|
||||||
|
public class ListOrganizationsPageTests : TestContext
|
||||||
|
{
|
||||||
|
private IOrganizationRepository _organizationRepository;
|
||||||
|
private IGlobalSettings _globalSettings;
|
||||||
|
|
||||||
|
public ListOrganizationsPageTests()
|
||||||
|
{
|
||||||
|
_organizationRepository = Substitute.For<IOrganizationRepository>();
|
||||||
|
_globalSettings = Substitute.For<IGlobalSettings>();
|
||||||
|
|
||||||
|
Services.AddSingleton(_organizationRepository);
|
||||||
|
Services.AddSingleton(_globalSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ListOrganizationsPage_Renders_EmailFieldAsInvalid_WhenInvalidEmailAddressIsEntered()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var cut = RenderComponent<ListOrganizationsPage>();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
|
||||||
|
cut.Find("input[name='SearchForm.Email']").Change("@@");
|
||||||
|
cut.Find("form").Submit();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Contains("invalid", cut.Find("input[name='SearchForm.Email']").Attributes["class"].Value);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user