diff --git a/test/client_info_mgt.test.js b/test/client_info_mgt.test.js index 3ebc058..dee6d0d 100644 --- a/test/client_info_mgt.test.js +++ b/test/client_info_mgt.test.js @@ -52,6 +52,26 @@ describe('Test client_info_mgt.js functions', () => { expect(user_data.queryContent).toEqual(queryContent); }); + test('Test handleUserQuery function, firsttime access', async () => { + const clientId = 'clientx'; + const userId = 'userx'; + const queryContent = 'latest smartphones'; + const newPreference = 'tech'; + const keywords_list = ['smartphone', 'tech', 'innovation']; + + const keywords = await handleUserQuery( + clientId, + userId, + queryContent, + newPreference, + keywords_list, + model, + ); + + expect(keywords).toContain('smartphone'); + console.log(keywords); + }); + test('Test handleUserQuery function with clientID', async () => { const clientId = 'client1'; const userId = 'user1'; @@ -72,6 +92,26 @@ describe('Test client_info_mgt.js functions', () => { console.log(keywords); }); + test('Test handleUserQuery function with the same user and user prerference', async () => { + const clientId = 'client1'; + const userId = 'user1'; + const queryContent = 'innovation'; + const newPreference = 'tech'; + const keywords_list = ['smartphone', 'tech', 'innovation']; + + const keywords = await handleUserQuery( + clientId, + userId, + queryContent, + newPreference, + keywords_list, + model, + ); + + expect(keywords).toContain('innovation'); + console.log(keywords); + }); + // Test handling multiple client instances test('Handle multiple client instances', async () => { const clientId1 = 'client1'; diff --git a/user_data.db b/user_data.db index 2f1350d..9ab9002 100644 Binary files a/user_data.db and b/user_data.db differ