Skip to content

Commit 5997536

Browse files
committed
feat(query): implement response for Andrew ID-related queries
1 parent 60656ab commit 5997536

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

__tests__/utils/QueryProcessor.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ describe("QueryProcessor", () => {
1818
));
1919
});
2020

21+
test('should return Andrew ID', () => {
22+
const query = "andrew id";
23+
const response: string = QueryProcessor(query);
24+
expect(response).toBe((
25+
"Your Andrew ID is usually the first letter of your first name followed" +
26+
"by your surname. For example, if your name is Andrew Carnegie, your " +
27+
"Andrew ID is 'acarnegie'."
28+
));
29+
});
30+
2131
test('should return name', () => {
2232
const query = "What is your name?";
2333
const response: string = QueryProcessor(query);

utils/QueryProcessor.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ export default function QueryProcessor(query: string): string {
77
);
88
}
99

10+
if (query.toLowerCase().includes("andrew id")) {
11+
return (
12+
"Your Andrew ID is usually the first letter of your first name followed" +
13+
"by your surname. For example, if your name is Andrew Carnegie, your " +
14+
"Andrew ID is 'acarnegie'."
15+
)
16+
}
17+
1018
if (query.toLowerCase().includes("name")) {
1119
return "Rohan";
1220
}

0 commit comments

Comments
 (0)