Skip to content

Commit

Permalink
Merge pull request #22 from Martin-lc/dev-mingxuan-t2
Browse files Browse the repository at this point in the history
Dev mingxuan t2
  • Loading branch information
Martin-lc authored Dec 10, 2023
2 parents e942bd9 + 73c08fc commit d8bb5a0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/client_info_mgt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down
Binary file modified user_data.db
Binary file not shown.

0 comments on commit d8bb5a0

Please sign in to comment.