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: add sendGroupMessages in webhook configs
- Loading branch information
Showing
6 changed files
with
84 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import { | |
getNormalizedMessage, | ||
isSaveMedia, | ||
extractDestinyPhone, | ||
isGroupMessage, | ||
} from '../../src/services/transformer' | ||
const key = { remoteJid: '[email protected]', id: 'abc' } | ||
|
||
|
@@ -68,6 +69,57 @@ describe('service transformer', () => { | |
expect(extractDestinyPhone(payload)).toBe('x') | ||
}) | ||
|
||
test('return isGroupMessage false with status', async () => { | ||
const payload = { | ||
entry: [ | ||
{ | ||
changes: [ | ||
{ | ||
value: { | ||
statuses: [{ recipient_id: 'x' }] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
expect(isGroupMessage(payload)).toBe(false) | ||
}) | ||
|
||
test('return isGroupMessage false with non group', async () => { | ||
const payload = { | ||
entry: [ | ||
{ | ||
changes: [ | ||
{ | ||
value: { | ||
contacts: [{ wa_id: 'y' }], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
expect(isGroupMessage(payload)).toBe(false) | ||
}) | ||
|
||
test('return isGroupMessage true', async () => { | ||
const payload = { | ||
entry: [ | ||
{ | ||
changes: [ | ||
{ | ||
value: { | ||
contacts: [{ group_id: 'y' }], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
expect(isGroupMessage(payload)).toBe(true) | ||
}) | ||
|
||
test('return empty extractDestinyPhone from api payload', async () => { | ||
expect(extractDestinyPhone({ to: 'y' })).toBe('y') | ||
}) | ||
|
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