Skip to content

Commit 94ad5ba

Browse files
authored
fix: handle orgs missing org names in the get-llmo-config-summary command (#1416)
1 parent 0ef4811 commit 94ad5ba

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/support/slack/commands/get-llmo-config-summary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function GetLlmoConfigSummaryCommand(context) {
9797
const stats = calculateStats(config);
9898
const organization = await Organization.findById(site.getOrganizationId());
9999
const imsOrgId = organization?.getImsOrgId();
100-
const imsOrgName = organization?.getName();
100+
const imsOrgName = organization?.getName() || 'N/A';
101101

102102
// Skip excluded IMS orgs
103103
if (EXCLUDED_IMS_ORGS.includes(imsOrgId)) {

test/support/slack/commands/get-llmo-config-summary.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,34 @@ describe('GetLlmoConfigSummaryCommand', () => {
142142
expect(context.log.info.calledWith(sinon.match('LLMO config summary completed: 1 sites processed'))).to.be.true;
143143
});
144144

145+
it('successfully generates CSV for missing IMS org name', async () => {
146+
const mockSites = [{
147+
getId: () => 'site-1',
148+
getBaseURL: () => 'https://test.com',
149+
getOrganizationId: () => 'org-1',
150+
getConfig: () => ({ getLlmoConfig: () => ({ llmo: true }) }),
151+
}];
152+
153+
const mockConfig = {
154+
categories: { cat1: {} },
155+
topics: { topic1: { prompts: ['prompt1'] } },
156+
brands: { aliases: ['alias1'] },
157+
competitors: { competitors: ['comp1'] },
158+
deleted: { prompts: { deleted1: {} } },
159+
cdnBucketConfig: { cdnProvider: 'cloudflare' },
160+
};
161+
162+
context.dataAccess.Site.all.resolves(mockSites);
163+
context.dataAccess.Organization.findById.resolves({ getImsOrgId: () => 'valid@AdobeOrg', getName: () => undefined });
164+
readConfigStub.resolves({ config: mockConfig, exists: true });
165+
166+
const command = GetLlmoConfigSummaryCommand(context);
167+
await command.handleExecution([], slackContext);
168+
169+
expect(sendFileStub.called).to.be.true;
170+
expect(context.log.info.calledWith(sinon.match('LLMO config summary completed: 1 sites processed'))).to.be.true;
171+
});
172+
145173
it('handles errors gracefully', async () => {
146174
context.dataAccess.Site.all.rejects(new Error('Database error'));
147175
const command = GetLlmoConfigSummaryCommand(context);

0 commit comments

Comments
 (0)