Revert "test: check old megalodon version"
This reverts commit 89eea5df52
.
This commit is contained in:
parent
08cd1f313c
commit
3fd2b55406
230 changed files with 21178 additions and 7596 deletions
|
@ -2,7 +2,7 @@ import MisskeyEntity from '@/misskey/entity'
|
|||
import MisskeyNotificationType from '@/misskey/notification'
|
||||
import Misskey from '@/misskey'
|
||||
import MegalodonNotificationType from '@/notification'
|
||||
import axios, { AxiosResponse } from 'axios'
|
||||
import axios, { AxiosHeaders, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
||||
|
||||
jest.mock('axios')
|
||||
|
||||
|
@ -27,6 +27,7 @@ const note: MisskeyEntity.Note = {
|
|||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {},
|
||||
reactionEmojis: {},
|
||||
emojis: [],
|
||||
fileIds: [],
|
||||
files: [],
|
||||
|
@ -93,7 +94,7 @@ const pollVote: MisskeyEntity.Notification = {
|
|||
createdAt: '2021-02-01T01:49:29',
|
||||
userId: user.id,
|
||||
user: user,
|
||||
type: MisskeyNotificationType.PollEnded,
|
||||
type: MisskeyNotificationType.PollVote,
|
||||
note: note
|
||||
}
|
||||
|
||||
|
@ -163,12 +164,12 @@ describe('getNotifications', () => {
|
|||
},
|
||||
{
|
||||
event: reaction,
|
||||
expected: MegalodonNotificationType.Reaction,
|
||||
expected: MegalodonNotificationType.EmojiReaction,
|
||||
title: 'reaction'
|
||||
},
|
||||
{
|
||||
event: pollVote,
|
||||
expected: MegalodonNotificationType.Poll,
|
||||
expected: MegalodonNotificationType.PollVote,
|
||||
title: 'pollVote'
|
||||
},
|
||||
{
|
||||
|
@ -180,25 +181,38 @@ describe('getNotifications', () => {
|
|||
event: followRequestAccepted,
|
||||
expected: MegalodonNotificationType.Follow,
|
||||
title: 'followRequestAccepted'
|
||||
},
|
||||
{
|
||||
event: groupInvited,
|
||||
expected: MisskeyNotificationType.GroupInvited,
|
||||
title: 'groupInvited'
|
||||
}
|
||||
]
|
||||
cases.forEach(c => {
|
||||
it(`should be ${c.title} event`, async () => {
|
||||
const config: InternalAxiosRequestConfig<any> = {
|
||||
headers: new AxiosHeaders()
|
||||
}
|
||||
const mockResponse: AxiosResponse<Array<MisskeyEntity.Notification>> = {
|
||||
data: [c.event],
|
||||
status: 200,
|
||||
statusText: '200OK',
|
||||
headers: {},
|
||||
config: {}
|
||||
config: config
|
||||
}
|
||||
;(axios.post as any).mockResolvedValue(mockResponse)
|
||||
const res = await client.getNotifications()
|
||||
expect(res.data[0].type).toEqual(c.expected)
|
||||
})
|
||||
})
|
||||
it('groupInvited event should be ignored', async () => {
|
||||
const config: InternalAxiosRequestConfig<any> = {
|
||||
headers: new AxiosHeaders()
|
||||
}
|
||||
const mockResponse: AxiosResponse<Array<MisskeyEntity.Notification>> = {
|
||||
data: [groupInvited],
|
||||
status: 200,
|
||||
statusText: '200OK',
|
||||
headers: {},
|
||||
config: config
|
||||
}
|
||||
;(axios.post as any).mockResolvedValue(mockResponse)
|
||||
const res = await client.getNotifications()
|
||||
expect(res.data).toEqual([])
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue