Skip to content

Commit 1e5dc84

Browse files
curbenghtomap
authored andcommitted
refactor: es6-fy (#104)
1 parent e6752e5 commit 1e5dc84

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

test/index.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
'use strict';
22

3-
var should = require('chai').should(); // eslint-disable-line
4-
var util = require('hexo-util');
3+
const should = require('chai').should(); // eslint-disable-line
4+
const util = require('hexo-util');
55

6-
describe('Marked renderer', function() {
7-
var ctx = {
6+
describe('Marked renderer', () => {
7+
const ctx = {
88
config: {
99
marked: {}
1010
}
1111
};
1212

13-
var r = require('../lib/renderer').bind(ctx);
13+
const r = require('../lib/renderer').bind(ctx);
1414

15-
it('default', function() {
16-
var code = 'console.log("Hello world");';
15+
it('default', () => {
16+
const code = 'console.log("Hello world");';
1717

18-
var body = [
18+
const body = [
1919
'# Hello world',
2020
'',
2121
'```',
@@ -27,7 +27,7 @@ describe('Marked renderer', function() {
2727
'hello'
2828
].join('\n');
2929

30-
var result = r({text: body});
30+
const result = r({text: body});
3131

3232
result.should.eql([
3333
'<h1 id="Hello-world"><a href="#Hello-world" class="headerlink" title="Hello world"></a>Hello world</h1>',
@@ -37,86 +37,86 @@ describe('Marked renderer', function() {
3737
].join('') + '\n');
3838
});
3939

40-
it('should render headings with links', function() {
41-
var body = [
40+
it('should render headings with links', () => {
41+
const body = [
4242
'## [hexo-server]',
4343
'',
4444
'[hexo-server]: https://github.com/hexojs/hexo-server'
4545
].join('\n');
4646

47-
var result = r({text: body});
47+
const result = r({text: body});
4848

4949
result.should.eql([
5050
'<h2 id="hexo-server"><a href="#hexo-server" class="headerlink" title="hexo-server"></a>',
5151
'<a href="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/hexojs/hexo-server">hexo-server</a></h2>'
5252
].join(''));
5353
});
5454

55-
it('should handle chinese headers properly', function() {
56-
var body = '# 中文';
57-
var result = r({text: body});
55+
it('should handle chinese headers properly', () => {
56+
const body = '# 中文';
57+
const result = r({text: body});
5858

5959
result.should.eql('<h1 id="中文"><a href="#中文" class="headerlink" title="中文"></a>中文</h1>');
6060
});
6161

6262
// Description List tests
6363

64-
it('should render description lists with a single space after the colon', function() {
65-
var result = r({text: 'Description Term<br>: This is the Description'});
64+
it('should render description lists with a single space after the colon', () => {
65+
const result = r({text: 'Description Term<br>: This is the Description'});
6666
result.should.eql('<dl><dt>Description Term</dt><dd>This is the Description</dd></dl>');
6767
});
6868

69-
it('should render description lists with multiple spaces after the colon', function() {
70-
var result = r({text: 'Description Term<br>: This is the Description'});
69+
it('should render description lists with multiple spaces after the colon', () => {
70+
const result = r({text: 'Description Term<br>: This is the Description'});
7171
result.should.eql('<dl><dt>Description Term</dt><dd>This is the Description</dd></dl>');
7272
});
7373

74-
it('should render description lists with a tab after the colon', function() {
75-
var result = r({text: 'Description Term<br>: This is the Description'});
74+
it('should render description lists with a tab after the colon', () => {
75+
const result = r({text: 'Description Term<br>: This is the Description'});
7676
result.should.eql('<dl><dt>Description Term</dt><dd>This is the Description</dd></dl>');
7777
});
7878

79-
it('should render description lists with a carriage return after the colon', function() {
80-
var result = r({text: 'Description Term<br>:\nThis is the Description'});
79+
it('should render description lists with a carriage return after the colon', () => {
80+
const result = r({text: 'Description Term<br>:\nThis is the Description'});
8181
result.should.eql('<dl><dt>Description Term</dt><dd>This is the Description</dd></dl>');
8282
});
8383

84-
it('should not render regular paragraphs as description lists', function() {
85-
var result = r({text: 'Description Term<br>:This is the Description'});
84+
it('should not render regular paragraphs as description lists', () => {
85+
const result = r({text: 'Description Term<br>:This is the Description'});
8686
result.should.eql('<p>Description Term<br>:This is the Description</p>\n');
8787
});
8888

89-
describe('autolink option tests', function() {
90-
var ctx = {
89+
describe('autolink option tests', () => {
90+
const ctx = {
9191
config: {
9292
marked: {
9393
autolink: true
9494
}
9595
}
9696
};
9797

98-
var renderer = require('../lib/renderer');
98+
const renderer = require('../lib/renderer');
9999

100-
var body = [
100+
const body = [
101101
'Great website http://hexo.io',
102102
'',
103103
'[Hexo](http://hexo.io)'
104104
].join('\n');
105105

106-
it('autolink enabled', function() {
107-
var r = renderer.bind(ctx);
108-
var result = r({text: body});
106+
it('autolink enabled', () => {
107+
const r = renderer.bind(ctx);
108+
const result = r({text: body});
109109

110110
result.should.eql([
111111
'<p>Great website <a href="http://hexo.io">http://hexo.io</a></p>\n',
112112
'<p><a href="http://hexo.io">Hexo</a></p>\n'
113113
].join(''));
114114
});
115115

116-
it('autolink disabled', function() {
116+
it('autolink disabled', () => {
117117
ctx.config.marked.autolink = false;
118-
var r = renderer.bind(ctx);
119-
var result = r({text: body});
118+
const r = renderer.bind(ctx);
119+
const result = r({text: body});
120120

121121
result.should.eql([
122122
'<p>Great website http://hexo.io</p>\n',
@@ -125,26 +125,26 @@ describe('Marked renderer', function() {
125125
});
126126
});
127127

128-
describe('modifyAnchors option tests', function() {
129-
var body = [
128+
describe('modifyAnchors option tests', () => {
129+
const body = [
130130
'- [Example](#example)',
131131
'',
132132
'# Example'
133133
].join('\n');
134134

135-
var renderer = require('../lib/renderer');
135+
const renderer = require('../lib/renderer');
136136

137-
var ctx = {
137+
const ctx = {
138138
config: {
139139
marked: {
140140
modifyAnchors: ''
141141
}
142142
}
143143
};
144144

145-
it('should not modify anchors with default options', function() {
146-
var r = renderer.bind(ctx);
147-
var result = r({text: body});
145+
it('should not modify anchors with default options', () => {
146+
const r = renderer.bind(ctx);
147+
const result = r({text: body});
148148

149149
result.should.eql([
150150
'<ul>',
@@ -154,10 +154,10 @@ describe('Marked renderer', function() {
154154
].join('\n'));
155155
});
156156

157-
it('should set anchors to upperCase in case of modifyAnchors option is 2', function() {
157+
it('should set anchors to upperCase in case of modifyAnchors option is 2', () => {
158158
ctx.config.marked.modifyAnchors = 2;
159-
var r = renderer.bind(ctx);
160-
var result = r({text: body});
159+
const r = renderer.bind(ctx);
160+
const result = r({text: body});
161161

162162
result.should.eql([
163163
'<ul>',
@@ -167,10 +167,10 @@ describe('Marked renderer', function() {
167167
].join('\n'));
168168
});
169169

170-
it('should set anchors to lowerCase in case of modifyAnchors option is 1', function() {
170+
it('should set anchors to lowerCase in case of modifyAnchors option is 1', () => {
171171
ctx.config.marked.modifyAnchors = 1;
172-
var r = renderer.bind(ctx);
173-
var result = r({text: body});
172+
const r = renderer.bind(ctx);
173+
const result = r({text: body});
174174

175175
result.should.eql([
176176
'<ul>',

0 commit comments

Comments
 (0)