Skip to content

Commit

Permalink
Merge pull request #75 from beckn/fix_for_developer_mode
Browse files Browse the repository at this point in the history
[Fix] Corrections for developer mode resolution
  • Loading branch information
mayurvir authored Apr 9, 2024
2 parents 07261e4 + dc038d9 commit 585aae4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Actions {
to: recipient.includes('whatsapp:') ? recipient : `whatsapp:${recipient}`,
}

if(media_url && !process.env.DEVELOPER_MODE_ON){
if(media_url && !parseInt(process.env.DEVELOPER_MODE_ON)){
body.mediaUrl = [media_url];
}
let data = await client.messages.create(body)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/controllers/bot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Test cases for Google maps', () => {
expect(source_gps).to.have.property('lng');
})

it.only('It should take a trip plannign input and generate static route image and directions link.', async () => {
it('It should take a trip plannign input and generate static route image and directions link.', async () => {
const ask = "Can you plean a trip from Denver to Yellowstone national park?";

// identify source and destination
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/services/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,13 @@ describe('should test send_message()', () => {
expect(error).to.be.an.instanceOf(Error);
}
});

it('Should test sending a message with media', async () => {
const recipient = process.env.TEST_RECEPIENT_NUMBER;
const message = 'This is an image';
const media_url = 'https://becknprotocol.io/wp-content/uploads/2022/03/logo.png';
let status = await actionsService.send_message(recipient, message, media_url);
expect(status.deliveryStatus).to.not.equal('failed')
});
});

0 comments on commit 585aae4

Please sign in to comment.