generated from dvdksn/clockbox
-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delay first message in webhooker service
- Loading branch information
Showing
8 changed files
with
97 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import { | |
DecryptError, | ||
getNormalizedMessage, | ||
isSaveMedia, | ||
extractDestinyPhone, | ||
} from '../../src/services/transformer' | ||
const key = { remoteJid: '[email protected]', id: 'abc' } | ||
|
||
|
@@ -33,6 +34,44 @@ const inputDocumentMessage: WAMessage = { | |
} | ||
|
||
describe('service transformer', () => { | ||
test('return y extractDestinyPhone from webhook payload message', async () => { | ||
const payload = { | ||
entry: [ | ||
{ | ||
changes: [ | ||
{ | ||
value: { | ||
contacts: [{ wa_id: 'y' }], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
expect(extractDestinyPhone(payload)).toBe('y') | ||
}) | ||
|
||
test('return x extractDestinyPhone from webhook payload status', async () => { | ||
const payload = { | ||
entry: [ | ||
{ | ||
changes: [ | ||
{ | ||
value: { | ||
statuses: [{ recipient_id: 'x' }] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
expect(extractDestinyPhone(payload)).toBe('x') | ||
}) | ||
|
||
test('return empty extractDestinyPhone from api payload', async () => { | ||
expect(extractDestinyPhone({ to: 'y' })).toBe('y') | ||
}) | ||
|
||
test('phoneNumberToJid with nine digit', async () => { | ||
expect(phoneNumberToJid('+5549988290955')).toEqual('[email protected]') | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters