forked from misskey-dev/misskey
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from taiyme/merge-upstream
- Loading branch information
Showing
14 changed files
with
632 additions
and
973 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,4 +90,45 @@ describe('ReactionService', () => { | |
assert.strictEqual(await reactionService.normalize('unknown'), '❤'); | ||
}); | ||
}); | ||
|
||
describe('convertLegacyReactions', () => { | ||
test('空の入力に対しては何もしない', () => { | ||
const input = {}; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), input); | ||
}); | ||
|
||
test('Unicode絵文字リアクションを変換してしまわない', () => { | ||
const input = { '👍': 1, '🍮': 2 }; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), input); | ||
}); | ||
|
||
test('カスタム絵文字リアクションを変換してしまわない', () => { | ||
const input = { ':like@.:': 1, ':[email protected]:': 2 }; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), input); | ||
}); | ||
|
||
test('文字列によるレガシーなリアクションを変換する', () => { | ||
const input = { 'like': 1, 'pudding': 2 }; | ||
const output = { '👍': 1, '🍮': 2 }; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), output); | ||
}); | ||
|
||
test('host部分が省略されたレガシーなカスタム絵文字リアクションを変換する', () => { | ||
const input = { ':custom_emoji:': 1 }; | ||
const output = { ':custom_emoji@.:': 1 }; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), output); | ||
}); | ||
|
||
test('「0個のリアクション」情報を削除する', () => { | ||
const input = { 'angry': 0 }; | ||
const output = {}; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), output); | ||
}); | ||
|
||
test('host部分の有無によりデコードすると同じ表記になるカスタム絵文字リアクションの個数情報を正しく足し合わせる', () => { | ||
const input = { ':custom_emoji:': 1, ':custom_emoji@.:': 2 }; | ||
const output = { ':custom_emoji@.:': 3 }; | ||
assert.deepStrictEqual(reactionService.convertLegacyReactions(input), output); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.