File tree Expand file tree Collapse file tree
tests/unit/pages/settings Expand file tree Collapse file tree Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments