-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test groupHandler(jobQueue) and groupMessage
- Loading branch information
Showing
9 changed files
with
1,902 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
const eventMock = jest.fn(); | ||
const sendMock = jest.fn(); | ||
const setMock = jest.fn(); | ||
const ga = jest.fn(); | ||
|
||
ga.mockImplementation(() => ({ | ||
event: eventMock, | ||
send: sendMock, | ||
set: setMock, | ||
screenview: () => {}, | ||
})); | ||
|
||
ga.clearAllMocks = () => { | ||
eventMock.mockClear(); | ||
sendMock.mockClear(); | ||
setMock.mockClear(); | ||
ga.mockClear(); | ||
}; | ||
|
||
ga.eventMock = eventMock; | ||
ga.sendMock = sendMock; | ||
ga.setMock = setMock; | ||
|
||
export default ga; |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const joinGroup = { | ||
replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA', | ||
type: 'join', | ||
mode: 'active', | ||
timestamp: 1462629479859, | ||
source: { | ||
type: 'group', | ||
groupId: 'C4a1', | ||
}, | ||
}; | ||
|
||
const leaveGroup = { | ||
replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA', | ||
type: 'leave', | ||
mode: 'active', | ||
timestamp: 1462629479859, | ||
source: { | ||
type: 'group', | ||
groupId: 'C4a1', | ||
}, | ||
}; | ||
|
||
const textMessage = { | ||
replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA', | ||
type: 'message', | ||
mode: 'active', | ||
timestamp: 1462629479859, | ||
message: { | ||
type: 'text', | ||
}, | ||
source: { | ||
type: 'group', | ||
groupId: 'C4a1', | ||
}, | ||
}; | ||
|
||
const expiredTextMessage = { | ||
replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA', | ||
type: 'message', | ||
mode: 'active', | ||
timestamp: 612921600000, | ||
message: { | ||
type: 'text', | ||
}, | ||
source: { | ||
type: 'group', | ||
groupId: 'C4a1', | ||
}, | ||
}; | ||
|
||
export default { joinGroup, leaveGroup, textMessage, expiredTextMessage }; |
Oops, something went wrong.