mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(flags): label Tor country flag
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getCommentFlagFlairs, getAuthorFlagFlairs, getAuthorFlagViewModels } from '../comment-flags';
|
||||
import { getCommentFlagFlairs, getAuthorFlagFlairs, getAuthorFlagViewModels, TOR_AUTHOR_FLAG_LABEL_KEY } from '../comment-flags';
|
||||
|
||||
describe('comment-flags', () => {
|
||||
it('parses the pkc-js challenge flair example for country flags', () => {
|
||||
@@ -25,6 +25,16 @@ describe('comment-flags', () => {
|
||||
expect(flags[2]).toMatchObject({ label: 'Applejack', x: 80, y: 0 });
|
||||
});
|
||||
|
||||
it('labels the xx country flag as Tor traffic', () => {
|
||||
const [flag] = getAuthorFlagViewModels([{ text: 'flag:country:xx' }], 1000);
|
||||
|
||||
expect(flag).toMatchObject({
|
||||
key: 'country:xx',
|
||||
label: 'This user is on Tor',
|
||||
labelKey: TOR_AUTHOR_FLAG_LABEL_KEY,
|
||||
});
|
||||
});
|
||||
|
||||
it('normalizes text flag kinds before parsing', () => {
|
||||
const flags = getAuthorFlagViewModels([{ text: 'FLAG:COUNTRY:DE' }, { text: 'POL:AC' }, { text: 'flag:MLP:AJ' }], 1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user