mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-25 07:25:13 +00:00
add test
This commit is contained in:
parent
a8c2304a2b
commit
861b57b51d
1 changed files with 13 additions and 1 deletions
14
test/main.ts
14
test/main.ts
|
@ -1,5 +1,5 @@
|
|||
import assert from 'assert';
|
||||
import { inspect, parse, parsePlain, toString } from '../built/index';
|
||||
import { extract, inspect, parse, parsePlain, toString } from '../built/index';
|
||||
import { createNode } from '../built/util';
|
||||
import {
|
||||
TEXT, CENTER, FN, UNI_EMOJI, MENTION, EMOJI_CODE, HASHTAG, N_URL, BOLD, SMALL, ITALIC, STRIKE, QUOTE, MATH_BLOCK, SEARCH, CODE_BLOCK
|
||||
|
@ -487,3 +487,15 @@ describe('inspect', () => {
|
|||
assert.strictEqual(toString(result), 'hello [tada everynyan!]');
|
||||
});
|
||||
});
|
||||
|
||||
describe('extract API', () => {
|
||||
it('basic', () => {
|
||||
const nodes = parse('abc:hoge:[tada 123:hoge:]:piyo:');
|
||||
const expect = [
|
||||
EMOJI_CODE('hoge'),
|
||||
EMOJI_CODE('hoge'),
|
||||
EMOJI_CODE('piyo')
|
||||
];
|
||||
assert.deepStrictEqual(extract(nodes, 'emojiCode'), expect);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue