-
Notifications
You must be signed in to change notification settings - Fork 1
/
lexer-code.spec.js
43 lines (32 loc) · 1.23 KB
/
lexer-code.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import _ from 'lodash';
import Lexer from '@/lexer';
describe('lexer:code', () => {
it('should be using 4 space before to setup code blocks', () => {
const mdString = ` This is a code block\n`;
let lexer = new Lexer();
let tokens = lexer.lex(mdString);
expect(tokens.length).to.eq(1);
expect(_.head(tokens).type).to.eq('code');
});
it('should be using 1 tab before to setup code blocks', () => {
const mdString = `\tThis is a code block\n`;
let lexer = new Lexer();
let tokens = lexer.lex(mdString);
expect(tokens.length).to.eq(1);
expect(_.head(tokens).type).to.eq('code');
});
it('should be using multi-line spaces to setup code blocks', () => {
const mdString = `\ttell application "Foo"\n\t\tbeep\n\tend tell\n`;
let lexer = new Lexer();
let tokens = lexer.lex(mdString);
expect(tokens.length).to.eq(1);
expect(_.head(tokens).type).to.eq('code');
});
it('should be using broken-line block to setup code blocks',()=>{
const mdString =`\`\`\`\ntell application "Foo"\n\t\tbeep\n\tend tell\n\`\`\`\n`;
let lexer = new Lexer();
let tokens = lexer.lex(mdString);
expect(tokens.length).to.eq(1);
expect(_.head(tokens).type).to.eq('code');
});
});