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
|
@ -14,8 +14,6 @@ const user: MisskeyEntity.User = {
|
|||
emojis: []
|
||||
}
|
||||
|
||||
const converter: MisskeyAPI.Converter = new MisskeyAPI.Converter("https://example.com")
|
||||
|
||||
describe('api_client', () => {
|
||||
describe('notification', () => {
|
||||
describe('encode', () => {
|
||||
|
@ -34,7 +32,7 @@ describe('api_client', () => {
|
|||
dist: MisskeyNotificationType.Reaction
|
||||
},
|
||||
{
|
||||
src: MegalodonNotificationType.Reaction,
|
||||
src: MegalodonNotificationType.EmojiReaction,
|
||||
dist: MisskeyNotificationType.Reaction
|
||||
},
|
||||
{
|
||||
|
@ -42,8 +40,8 @@ describe('api_client', () => {
|
|||
dist: MisskeyNotificationType.Renote
|
||||
},
|
||||
{
|
||||
src: MegalodonNotificationType.Poll,
|
||||
dist: MisskeyNotificationType.PollEnded
|
||||
src: MegalodonNotificationType.PollVote,
|
||||
dist: MisskeyNotificationType.PollVote
|
||||
},
|
||||
{
|
||||
src: MegalodonNotificationType.FollowRequest,
|
||||
|
@ -51,7 +49,7 @@ describe('api_client', () => {
|
|||
}
|
||||
]
|
||||
cases.forEach(c => {
|
||||
expect(converter.encodeNotificationType(c.src)).toEqual(c.dist)
|
||||
expect(MisskeyAPI.Converter.encodeNotificationType(c.src)).toEqual(c.dist)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -80,11 +78,11 @@ describe('api_client', () => {
|
|||
},
|
||||
{
|
||||
src: MisskeyNotificationType.Reaction,
|
||||
dist: MegalodonNotificationType.Reaction
|
||||
dist: MegalodonNotificationType.EmojiReaction
|
||||
},
|
||||
{
|
||||
src: MisskeyNotificationType.PollEnded,
|
||||
dist: MegalodonNotificationType.Poll
|
||||
src: MisskeyNotificationType.PollVote,
|
||||
dist: MegalodonNotificationType.PollVote
|
||||
},
|
||||
{
|
||||
src: MisskeyNotificationType.ReceiveFollowRequest,
|
||||
|
@ -96,7 +94,7 @@ describe('api_client', () => {
|
|||
}
|
||||
]
|
||||
cases.forEach(c => {
|
||||
expect(converter.decodeNotificationType(c.src)).toEqual(c.dist)
|
||||
expect(MisskeyAPI.Converter.decodeNotificationType(c.src)).toEqual(c.dist)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -162,7 +160,7 @@ describe('api_client', () => {
|
|||
}
|
||||
]
|
||||
|
||||
const reactions = converter.reactions(misskeyReactions)
|
||||
const reactions = MisskeyAPI.Converter.reactions(misskeyReactions)
|
||||
expect(reactions).toEqual([
|
||||
{
|
||||
count: 3,
|
||||
|
@ -194,13 +192,14 @@ describe('api_client', () => {
|
|||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {},
|
||||
reactionEmojis: {},
|
||||
emojis: [],
|
||||
fileIds: [],
|
||||
files: [],
|
||||
replyId: null,
|
||||
renoteId: null
|
||||
}
|
||||
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
||||
const megalodonStatus = MisskeyAPI.Converter.note(note)
|
||||
expect(megalodonStatus.plain_content).toEqual(plainContent)
|
||||
expect(megalodonStatus.content).toEqual(content)
|
||||
})
|
||||
|
@ -218,16 +217,161 @@ describe('api_client', () => {
|
|||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {},
|
||||
reactionEmojis: {},
|
||||
emojis: [],
|
||||
fileIds: [],
|
||||
files: [],
|
||||
replyId: null,
|
||||
renoteId: null
|
||||
}
|
||||
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
||||
const megalodonStatus = MisskeyAPI.Converter.note(note)
|
||||
expect(megalodonStatus.plain_content).toEqual(plainContent)
|
||||
expect(megalodonStatus.content).toEqual(content)
|
||||
})
|
||||
})
|
||||
describe('emoji reaction', () => {
|
||||
it('reactionEmojis should be parsed', () => {
|
||||
const plainContent = 'hoge\nfuga\nfuga'
|
||||
const note: MisskeyEntity.Note = {
|
||||
id: '1',
|
||||
createdAt: '2021-02-01T01:49:29',
|
||||
userId: '1',
|
||||
user: user,
|
||||
text: plainContent,
|
||||
cw: null,
|
||||
visibility: 'public',
|
||||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {
|
||||
':example1@.:': 1,
|
||||
':example2@example.com:': 2
|
||||
},
|
||||
reactionEmojis: {
|
||||
'example2@example.com': 'https://example.com/emoji.png'
|
||||
},
|
||||
emojis: [],
|
||||
fileIds: [],
|
||||
files: [],
|
||||
replyId: null,
|
||||
renoteId: null
|
||||
}
|
||||
const megalodonStatus = MisskeyAPI.Converter.note(note)
|
||||
expect(megalodonStatus.emojis).toEqual([
|
||||
{
|
||||
shortcode: 'example2@example.com',
|
||||
static_url: 'https://example.com/emoji.png',
|
||||
url: 'https://example.com/emoji.png',
|
||||
visible_in_picker: true,
|
||||
category: ''
|
||||
}
|
||||
])
|
||||
expect(megalodonStatus.emoji_reactions).toEqual([
|
||||
{
|
||||
count: 1,
|
||||
me: false,
|
||||
name: ':example1@.:'
|
||||
},
|
||||
{
|
||||
count: 2,
|
||||
me: false,
|
||||
name: ':example2@example.com:'
|
||||
}
|
||||
])
|
||||
})
|
||||
})
|
||||
describe('emoji', () => {
|
||||
it('emojis in array format should be parsed', () => {
|
||||
const plainContent = 'hoge\nfuga\nfuga'
|
||||
const note: MisskeyEntity.Note = {
|
||||
id: '1',
|
||||
createdAt: '2021-02-01T01:49:29',
|
||||
userId: '1',
|
||||
user: user,
|
||||
text: plainContent,
|
||||
cw: null,
|
||||
visibility: 'public',
|
||||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {},
|
||||
reactionEmojis: {},
|
||||
emojis: [
|
||||
{
|
||||
aliases: [],
|
||||
name: ':example1:',
|
||||
url: 'https://example.com/emoji1.png',
|
||||
category: '',
|
||||
},
|
||||
{
|
||||
aliases: [],
|
||||
name: ':example2:',
|
||||
url: 'https://example.com/emoji2.png',
|
||||
category: '',
|
||||
},
|
||||
],
|
||||
fileIds: [],
|
||||
files: [],
|
||||
replyId: null,
|
||||
renoteId: null
|
||||
}
|
||||
const megalodonStatus = MisskeyAPI.Converter.note(note)
|
||||
expect(megalodonStatus.emojis).toEqual([
|
||||
{
|
||||
shortcode: ':example1:',
|
||||
static_url: 'https://example.com/emoji1.png',
|
||||
url: 'https://example.com/emoji1.png',
|
||||
visible_in_picker: true,
|
||||
category: ''
|
||||
},
|
||||
{
|
||||
shortcode: ':example2:',
|
||||
static_url: 'https://example.com/emoji2.png',
|
||||
url: 'https://example.com/emoji2.png',
|
||||
visible_in_picker: true,
|
||||
category: ''
|
||||
}
|
||||
])
|
||||
})
|
||||
it('emojis in object format should be parsed', () => {
|
||||
const plainContent = 'hoge\nfuga\nfuga'
|
||||
const note: MisskeyEntity.Note = {
|
||||
id: '1',
|
||||
createdAt: '2021-02-01T01:49:29',
|
||||
userId: '1',
|
||||
user: user,
|
||||
text: plainContent,
|
||||
cw: null,
|
||||
visibility: 'public',
|
||||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
reactions: {},
|
||||
reactionEmojis: {},
|
||||
emojis: {
|
||||
':example1:': 'https://example.com/emoji1.png',
|
||||
':example2:': 'https://example.com/emoji2.png',
|
||||
},
|
||||
fileIds: [],
|
||||
files: [],
|
||||
replyId: null,
|
||||
renoteId: null
|
||||
}
|
||||
const megalodonStatus = MisskeyAPI.Converter.note(note)
|
||||
expect(megalodonStatus.emojis).toEqual([
|
||||
{
|
||||
shortcode: ':example1:',
|
||||
static_url: 'https://example.com/emoji1.png',
|
||||
url: 'https://example.com/emoji1.png',
|
||||
visible_in_picker: true,
|
||||
category: ''
|
||||
},
|
||||
{
|
||||
shortcode: ':example2:',
|
||||
static_url: 'https://example.com/emoji2.png',
|
||||
url: 'https://example.com/emoji2.png',
|
||||
visible_in_picker: true,
|
||||
category: ''
|
||||
}
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue