fix: ensure default calendars domain (#27645)

* fix: ensure default calendars delegation credential domain

* fix: ensure default calendars delegation credential domain
This commit is contained in:
Morgan
2026-02-05 09:22:29 +00:00
committed by GitHub
parent bd25cba89c
commit cf55b5b462
4 changed files with 6 additions and 6 deletions
@@ -139,7 +139,7 @@ describe("Organizations Delegation Credentials Endpoints", () => {
data: {
workspacePlatformId: workspacePlatform.id,
organizationId: org.id,
domain: "@test-domain.com",
domain: "test-domain.com",
serviceAccountKey: encryptedServiceAccountKey,
enabled: false,
},
@@ -194,7 +194,7 @@ describe("Organizations Delegation Credentials Endpoints", () => {
expect(responseBody.status).toEqual(SUCCESS_STATUS);
expect(responseBody.data.enabled).toEqual(true);
expect(ensureDefaultCalendarsSpy).toHaveBeenCalledWith(org.id, "@test-domain.com");
expect(ensureDefaultCalendarsSpy).toHaveBeenCalledWith(org.id, "test-domain.com");
});
it("should not call ensureDefaultCalendars when disabling delegation credentials", async () => {
@@ -37,7 +37,7 @@ export class OrganizationsDelegationCredentialRepository {
},
where: {
organizationId: orgId,
user: { email: { endsWith: domain } },
user: { email: { endsWith: `@${domain}`, mode: "insensitive" } },
},
});
}
@@ -172,7 +172,7 @@ describe("OrganizationsDelegationCredentialService", () => {
await service.ensureDefaultCalendarsForUser(orgId, userId, userEmail);
expect(mockRepository.findEnabledByOrgIdAndDomain).toHaveBeenCalledWith(orgId, "@example.com");
expect(mockRepository.findEnabledByOrgIdAndDomain).toHaveBeenCalledWith(orgId, "example.com");
expect(mockQueue.add).toHaveBeenCalledWith(
DEFAULT_CALENDARS_JOB,
{ userId },
@@ -198,7 +198,7 @@ describe("OrganizationsDelegationCredentialService", () => {
await service.ensureDefaultCalendarsForUser(orgId, userId, userEmail);
expect(mockRepository.findEnabledByOrgIdAndDomain).toHaveBeenCalledWith(orgId, "@example.com");
expect(mockRepository.findEnabledByOrgIdAndDomain).toHaveBeenCalledWith(orgId, "example.com");
expect(mockQueue.add).not.toHaveBeenCalled();
});
@@ -174,7 +174,7 @@ export class OrganizationsDelegationCredentialService {
this.logger.warn(`Invalid email format for user ${userId}: missing domain`);
return;
}
const emailDomain = `@${emailParts[1]}`;
const emailDomain = emailParts[1];
const delegationCredential =
await this.organizationsDelegationCredentialRepository.findEnabledByOrgIdAndDomain(