mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
622 B
TypeScript
21 lines
622 B
TypeScript
import { regMessageTextDecorators } from '@/plugin/common';
|
|
import { preprocessMessage } from '../preprocessMessage';
|
|
|
|
regMessageTextDecorators(() => ({
|
|
emoji: (code) => `[emoji]${code}[/emoji]`,
|
|
}));
|
|
|
|
describe('preprocessMessage', () => {
|
|
test('should be transform emoji code', () => {
|
|
expect(preprocessMessage('anystring :robot_face: anystring :heart:')).toBe(
|
|
'anystring [emoji]robot_face[/emoji] anystring [emoji]heart[/emoji]'
|
|
);
|
|
});
|
|
|
|
test('should ignore non-emoji code between ::', () => {
|
|
expect(preprocessMessage('2023-12-31 01:11:17')).toBe(
|
|
'2023-12-31 01:11:17'
|
|
);
|
|
});
|
|
});
|