Skip to content

Commit 919a440

Browse files
committed
Add test to exclude agents with missing personal details from AgentsPage list
1 parent 1395368 commit 919a440

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/unit/pages/settings/AgentsPageTest.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,22 @@ describe('AgentsPage', () => {
177177
expect(output).toContain('Test Agent');
178178
expect(output).not.toContain('agentsPage.emptyAgents.title');
179179
});
180+
181+
it('excludes agents whose personal details are missing from the list', () => {
182+
const TEST_ACCOUNT_ID = 12345;
183+
mockUseOnyx.mockImplementation((key) => {
184+
if (key === ONYXKEYS.COLLECTION.SHARED_NVP_AGENT_PROMPT) {
185+
return [{[`${ONYXKEYS.COLLECTION.SHARED_NVP_AGENT_PROMPT}${TEST_ACCOUNT_ID}`]: {prompt: 'Test prompt'}}, {status: 'loaded'}];
186+
}
187+
// personalDetailsList has no entry for TEST_ACCOUNT_ID
188+
if (key === ONYXKEYS.PERSONAL_DETAILS_LIST) {
189+
return [{}, {status: 'loaded'}];
190+
}
191+
return [undefined, {status: 'loaded'}];
192+
});
193+
194+
const {toJSON} = render(<AgentsPage />);
195+
196+
expect(JSON.stringify(toJSON())).toContain('agentsPage.emptyAgents.title');
197+
});
180198
});

0 commit comments

Comments
 (0)