mirror of
https://github.com/bitwarden/server.git
synced 2025-04-28 08:12:22 -05:00
Verify table is populated properly
This commit is contained in:
parent
7ca5898ae3
commit
aec903d67f
@ -1,4 +1,5 @@
|
|||||||
using Bit.Admin.AdminConsole.Components.Pages.Organizations;
|
using Bit.Admin.AdminConsole.Components.Pages.Organizations;
|
||||||
|
using Bit.Core.AdminConsole.Entities;
|
||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
using Bit.Core.Settings;
|
using Bit.Core.Settings;
|
||||||
using Bunit;
|
using Bunit;
|
||||||
@ -35,4 +36,39 @@ public class ListOrganizationsPageTests : TestContext
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.Contains("invalid", cut.Find("input[name='SearchForm.Email']").Attributes["class"].Value);
|
Assert.Contains("invalid", cut.Find("input[name='SearchForm.Email']").Attributes["class"].Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ListOrganizationsPage_PopulatesTable_WhenSearchFormIsSubmitted()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expectedOrganization = new Organization { Id = Guid.NewGuid(), Name = "Example" };
|
||||||
|
_organizationRepository.SearchAsync(
|
||||||
|
"Example",
|
||||||
|
"johndoe@example.com",
|
||||||
|
null,
|
||||||
|
Arg.Any<int>(),
|
||||||
|
Arg.Any<int>()).Returns(new List<Organization>
|
||||||
|
{
|
||||||
|
expectedOrganization
|
||||||
|
});
|
||||||
|
var cut = RenderComponent<ListOrganizationsPage>();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
cut.Find("input[name='SearchForm.Name']").Change("Example");
|
||||||
|
cut.Find("input[name='SearchForm.Email']").Change("johndoe@example.com");
|
||||||
|
cut.Find("form").Submit();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
_organizationRepository.Received(1).SearchAsync(
|
||||||
|
"Example",
|
||||||
|
"johndoe@example.com",
|
||||||
|
null,
|
||||||
|
Arg.Any<int>(),
|
||||||
|
Arg.Any<int>());
|
||||||
|
|
||||||
|
var rows = cut.FindAll("tbody>tr");
|
||||||
|
Assert.Single(rows);
|
||||||
|
|
||||||
|
Assert.Contains(expectedOrganization.Name, rows[0].TextContent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user