added test case

This commit is contained in:
Gautam Manchandani
2025-12-18 18:11:56 +05:30
parent 6b31a4fece
commit 15a12fa5e8

View File

@@ -444,4 +444,32 @@ describe("organization hooks", async () => {
});
expect(afterCreateTeam).toHaveBeenCalled();
});
it("should allow internal organization creation when disabled for users", async () => {
const { auth } = await getTestInstance({
plugins: [
organization({
allowUserToCreateOrganization: false,
}),
],
});
const newUser = await auth.api.signUpEmail({
body: {
email: "internal@test.com",
password: "password",
name: "Internal User",
},
});
const internalOrg = await auth.api.createOrganization({
body: {
name: "Internal Org",
slug: "internal-org",
userId: newUser.user.id,
},
});
expect(internalOrg).toBeDefined();
expect(internalOrg?.name).toBe("Internal Org");
});
});