Skip to content

Commit

Permalink
Fixes for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurvir committed Mar 30, 2024
1 parent 8ebcfe8 commit 60b4678
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/data/api_responses/on_init.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
]
},
"billing": {
"name": "Mayur Virendra",
"email": "mayurlibra@gmail.com",
"phone": "9986949245"
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "9000000001"
},
"categories": [
{
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/services/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Test cases for process_instruction function', ()=> {
it('Should test process_instruction() for a search intent', async () => {
const message = "I'm looking for some ev chargers.";
const response = await actionsService.process_instruction(message);
expect(response.formatted).to.contain('ChargeZone.in');
expect(response.formatted).to.be.a('string');
})

it('Should test succesfull process instruction with response status:false', async () => {
Expand All @@ -32,7 +32,7 @@ describe('Test cases for process_instruction function', ()=> {
it('Should test succesfull process instruction for Searching a ev charging station', async () => {
const messageBody = "I want to search ev charging";
const data = await actionsService.process_instruction(messageBody);
expect(data.formatted).to.contain('ChargeZone.in')
expect(data.formatted).to.be.a('string')
})


Expand Down
6 changes: 3 additions & 3 deletions tests/unit/services/ai.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Test cases for services/ai/get_beckn_action_from_text()', () => {
{"role": "user", "content": "I want to select the first item"},
{"role": "assistant", "content": JSON.stringify(on_select)}
];
const response = await ai.get_beckn_action_from_text('Lets place the order. My details are : Mayur Virendra, 9986949245, mayurlibra@gmail.com', context);
const response = await ai.get_beckn_action_from_text('Lets place the order. My details are : John Doe, john.doe@example.com, 9999999999', context);
expect(response.action).to.be.eq('init');
})

Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Test cases for services/ai/get_beckn_request_from_text()', () => {
{"role": "user", "content": "I want to select the first item"},
{"role": "assistant", "content": JSON.stringify(on_select)}
]
const response = await ai.get_beckn_request_from_text("Lets place the order. My details are : Mayur Virendra, 9986949245, mayurlibra@gmail.com", context);
const response = await ai.get_beckn_request_from_text("Lets place the order. My details are : John Doe, john.doe@example.com, 9999999999", context);
expect(response.data).to.be.an('object')
expect(response.data.method.toUpperCase()).to.be.eq('POST')
expect(response.data.url).to.contain('init')
Expand All @@ -129,7 +129,7 @@ describe('Test cases for services/ai/get_beckn_request_from_text()', () => {
{"role": "assistant", "content": JSON.stringify(on_search_compressed)},
{"role": "user", "content": "I want to select the first item"},
{"role": "assistant", "content": JSON.stringify(on_select)},
{"role": "user", "content": "Lets place the order. My details are : Mayur Virendra, 9986949245, mayurlibra@gmail.com"},
{"role": "user", "content": "Lets place the order. My details are : John Doe, john.doe@example.com, 9999999999"},
{"role": "assistant", "content": JSON.stringify(on_init)}
]
const response = await ai.get_beckn_request_from_text("Lets confirm the order!", context);
Expand Down

0 comments on commit 60b4678

Please sign in to comment.