mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 23:53:17 -05:00
chore: combined filter and search operator test (#5299)
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user