chore: combined filter and search operator test (#5299)

This commit is contained in:
KinfeMichael Tariku
2025-10-14 16:56:42 +00:00
committed by GitHub
parent 5da4af0146
commit 4eef777a7d
@@ -335,7 +335,24 @@ describe("Admin plugin", async () => {
headers: adminHeaders,
},
});
});
it("should allow to combine search and filter", async () => {
const res = await client.admin.listUsers({
query: {
filterValue: "admin",
filterField: "role",
filterOperator: "eq",
searchValue: "test",
searchField: "email",
searchOperator: "contains",
},
fetchOptions: {
headers: adminHeaders,
},
});
expect(res.data?.users.length).toBe(1);
expect(res.data?.users[0]!.email).toBe("test@test.com");
});
it("should allow to set user role", async () => {
@@ -682,7 +699,7 @@ describe("Admin plugin", async () => {
headers: adminHeaders,
},
});
expect(response.data?.users.length).toBe(2);
expect(response.data?.users.length).toBeGreaterThanOrEqual(2);
const roles = response.data?.users.map((d) => d.role);
expect(roles).not.toContain("user");
});