Skip to content
Snippets Groups Projects
Commit 3c1b3cb5 authored by marihachi's avatar marihachi
Browse files

add test

parent c2769a7c
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import assert from 'assert'; ...@@ -2,7 +2,7 @@ import assert from 'assert';
import { parse, parsePlain } from '../built/index'; import { parse, parsePlain } from '../built/index';
import { createNode } from '../built/util'; import { createNode } from '../built/util';
import { import {
TEXT, CENTER, FN, UNI_EMOJI, MENTION, CUSTOM_EMOJI, HASHTAG, N_URL, BOLD, SMALL, ITALIC, STRIKE TEXT, CENTER, FN, UNI_EMOJI, MENTION, CUSTOM_EMOJI, HASHTAG, N_URL, BOLD, SMALL, ITALIC, STRIKE, QUOTE
} from './node'; } from './node';
describe('text', () => { describe('text', () => {
...@@ -13,6 +13,70 @@ describe('text', () => { ...@@ -13,6 +13,70 @@ describe('text', () => {
}); });
}); });
describe('quote', () => {
it('single', () => {
const input = '> abc';
const output = [
QUOTE([
TEXT('abc')
])
];
assert.deepStrictEqual(parse(input), output);
});
it('multiple', () => {
const input = `
> abc
> 123
`;
const output = [
TEXT('\n'),
QUOTE([
TEXT('abc\n123')
]),
TEXT('\n')
];
assert.deepStrictEqual(parse(input), output);
});
it('with block (center)', () => {
const input = `
> <center>
> a
> </center>
`;
const output = [
TEXT('\n'),
QUOTE([
CENTER([
TEXT('\na\n')
])
]),
TEXT('\n')
];
assert.deepStrictEqual(parse(input), output);
});
it('with block (center, mention)', () => {
const input = `
> <center>
> I'm @ai, An bot of misskey!
> </center>
`;
const output = [
TEXT('\n'),
QUOTE([
CENTER([
TEXT('\nI\'m '),
MENTION('ai', null, '@ai'),
TEXT(', An bot of misskey!\n'),
])
]),
TEXT('\n')
];
assert.deepStrictEqual(parse(input), output);
});
});
describe('fn', () => { describe('fn', () => {
it('basic', () => { it('basic', () => {
const input = '[tada abc]'; const input = '[tada abc]';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment