Skip to content

Commit

Permalink
Fix test that doesn't make sense in usePublicRoomDirectory-test.tsx (#…
Browse files Browse the repository at this point in the history
…29335)

* remove test that doesn't make sense

* Actually let's fix the test rather than remove it

* Add comment, remove consoles.
  • Loading branch information
langleyd authored Feb 22, 2025
1 parent 0cbc6f9 commit 27c0e97
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/unit-tests/hooks/usePublicRoomDirectory-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ describe("usePublicRoomDirectory", () => {
cli.getDomain = () => "matrix.org";
cli.getThirdpartyProtocols = () => Promise.resolve({});
cli.publicRooms = ({ filter }: IRoomDirectoryOptions) => {
const chunk = filter?.generic_search_term
? [
{
room_id: "hello world!",
name: filter.generic_search_term,
world_readable: true,
guest_can_join: true,
num_joined_members: 1,
},
]
: [];
const chunk = [
{
room_id: "hello world!",
name: filter?.generic_search_term ?? "", // If the query is "" no filter is applied(an is undefined here), in keeping with the pattern let's call the room ""
world_readable: true,
guest_can_join: true,
num_joined_members: 1,
},
];
return Promise.resolve({
chunk,
total_room_count_estimate: 1,
Expand Down Expand Up @@ -67,7 +65,7 @@ describe("usePublicRoomDirectory", () => {
});

it("should work with empty queries", async () => {
const query = "ROOM NAME";
const query = "";
const { result } = render();

act(() => {
Expand Down

0 comments on commit 27c0e97

Please sign in to comment.