Skip to content

Commit

Permalink
Order of users returned from query does not matter
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Nov 19, 2024
1 parent 42f2442 commit e037ab9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions backend/Testing/LexCore/Services/UserServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task ManagerCanSeeAllUsersEvenInConfidentialProjects()
var authUser = new LexAuthUser(Robin!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
// John, who is in both the Outlaws org (user) and Sherwood project (member) is not duplicated
users.Should().BeEquivalentTo([Robin, Marian, John, Tuck]);
users.Should().BeEquivalentTo([Robin, Marian, John, Tuck], options => options.WithoutStrictOrdering());
}

[Fact]
Expand All @@ -102,7 +102,7 @@ public async Task NonManagerCanNotSeeUsersInConfidentialProjects()
var authUser = new LexAuthUser(John!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
// John can see Robin because he shares an org, but not Marian even though she's a manager of the Sherwood project
users.Should().BeEquivalentTo([Robin, John]);
users.Should().BeEquivalentTo([Robin, John], options => options.WithoutStrictOrdering());
}

[Fact]
Expand All @@ -112,7 +112,7 @@ public async Task ManagerOfOneProjectAndMemberOfAnotherPublicProjectCanSeeUsersI
var authUser = new LexAuthUser(Marian!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
// Marian can see everyone in both projects; Tuck is not duplicated despite being in both projects
users.Should().BeEquivalentTo([Robin, Marian, John, Tuck, Sheriff]);
users.Should().BeEquivalentTo([Robin, Marian, John, Tuck, Sheriff], options => options.WithoutStrictOrdering());
}

[Fact]
Expand All @@ -126,7 +126,7 @@ public async Task ManagerOfOneProjectAndMemberOfAnotherConfidentialProjectCanNot
// ... but can still only see the users in Nottingham and LawEnforcement
var authUser = new LexAuthUser(Sheriff!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
users.Should().BeEquivalentTo([Sheriff, Guy, Marian, Tuck]);
users.Should().BeEquivalentTo([Sheriff, Guy, Marian, Tuck], options => options.WithoutStrictOrdering());
}
finally
{
Expand All @@ -140,7 +140,7 @@ public async Task OrgAdminsInNoProjectsCanSeeOnlyTheirOrg()
// Bishop of Hereford is in Church org (admin) but no projects
var authUser = new LexAuthUser(Bishop!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
users.Should().BeEquivalentTo([Bishop, Tuck]);
users.Should().BeEquivalentTo([Bishop, Tuck], options => options.WithoutStrictOrdering());
}

[Fact]
Expand All @@ -149,7 +149,7 @@ public async Task OrgMembersInNoProjectsCanSeeOnlyTheirOrg()
// Guy of Gisborne is in LawEnforcement org (user) but no projects
var authUser = new LexAuthUser(Guy!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
users.Should().BeEquivalentTo([Sheriff, Guy]);
users.Should().BeEquivalentTo([Sheriff, Guy], options => options.WithoutStrictOrdering());
}

[Fact]
Expand All @@ -159,7 +159,7 @@ public async Task OrgAndProjectMembersCanSeeFellowOrgMembersAndFellowPublicProje
var authUser = new LexAuthUser(Tuck!);
var users = await _userService.UserQueryForTypeahead(authUser).ToArrayAsync();
// Tuck can see everyone in Church and Nottingham, but nobody in Sherwood because it's private — though he can see Marian because he shares a public project with her
users.Should().BeEquivalentTo([Bishop, Tuck, Sheriff, Marian]);
users.Should().BeEquivalentTo([Bishop, Tuck, Sheriff, Marian], options => options.WithoutStrictOrdering());
}

private User CreateUser(string name)
Expand Down

0 comments on commit e037ab9

Please sign in to comment.