comma dangle
This commit is contained in:
+14
-10
@@ -4,38 +4,42 @@ module.exports = {
|
|||||||
'commonjs': true,
|
'commonjs': true,
|
||||||
'es2021': true,
|
'es2021': true,
|
||||||
'node': true,
|
'node': true,
|
||||||
'jest/globals': true
|
'jest/globals': true,
|
||||||
},
|
},
|
||||||
'extends': ['eslint:recommended', 'plugin:jest/recommended'],
|
'extends': ['eslint:recommended', 'plugin:jest/recommended'],
|
||||||
'parserOptions': {
|
'parserOptions': {
|
||||||
'ecmaVersion': 12
|
'ecmaVersion': 12,
|
||||||
},
|
},
|
||||||
'rules': {
|
'rules': {
|
||||||
'indent': [
|
'indent': [
|
||||||
'error',
|
'error',
|
||||||
4
|
4,
|
||||||
],
|
],
|
||||||
'linebreak-style': [
|
'linebreak-style': [
|
||||||
'error',
|
'error',
|
||||||
'unix'
|
'unix',
|
||||||
],
|
],
|
||||||
'quotes': [
|
'quotes': [
|
||||||
'error',
|
'error',
|
||||||
'single'
|
'single',
|
||||||
],
|
],
|
||||||
'semi': [
|
'semi': [
|
||||||
'error',
|
'error',
|
||||||
'always'
|
'always',
|
||||||
],
|
],
|
||||||
'curly': [
|
'curly': [
|
||||||
'error',
|
'error',
|
||||||
'all'
|
'all',
|
||||||
],
|
],
|
||||||
'brace-style': [
|
'brace-style': [
|
||||||
'error',
|
'error',
|
||||||
'1tbs'
|
'1tbs',
|
||||||
],
|
],
|
||||||
'jest/no-done-callback': 'off',
|
'jest/no-done-callback': 'off',
|
||||||
'jest/expect-expect': 'off'
|
'jest/expect-expect': 'off',
|
||||||
}
|
'comma-dangle': [
|
||||||
|
'error',
|
||||||
|
'always-multiline',
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+4
-4
@@ -93,7 +93,7 @@ module.exports = (config) => {
|
|||||||
host: host,
|
host: host,
|
||||||
version: pjson.version,
|
version: pjson.version,
|
||||||
request: req,
|
request: req,
|
||||||
config: config
|
config: config,
|
||||||
};
|
};
|
||||||
res.render(vPath, data, (err, html) => {
|
res.render(vPath, data, (err, html) => {
|
||||||
if (err && vPath !== path.join(config['data_dir'], config['home']['error'])) {
|
if (err && vPath !== path.join(config['data_dir'], config['home']['error'])) {
|
||||||
@@ -130,7 +130,7 @@ module.exports = (config) => {
|
|||||||
//rate limit for safer server
|
//rate limit for safer server
|
||||||
const limiter = rateLimit({
|
const limiter = rateLimit({
|
||||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||||
max: config['rate_limit']
|
max: config['rate_limit'],
|
||||||
});
|
});
|
||||||
app.use(limiter);
|
app.use(limiter);
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ module.exports = (config) => {
|
|||||||
'title': config['rss']['title'],
|
'title': config['rss']['title'],
|
||||||
'description': config['rss']['description'],
|
'description': config['rss']['description'],
|
||||||
'feed_url': host + req.url,
|
'feed_url': host + req.url,
|
||||||
'site_url': host
|
'site_url': host,
|
||||||
});
|
});
|
||||||
Object.values(articles)
|
Object.values(articles)
|
||||||
.slice(0, config['rss']['length'])
|
.slice(0, config['rss']['length'])
|
||||||
@@ -182,7 +182,7 @@ module.exports = (config) => {
|
|||||||
feed.item({
|
feed.item({
|
||||||
title: article.title,
|
title: article.title,
|
||||||
url: host + article.url,
|
url: host + article.url,
|
||||||
date: article.date
|
date: article.date,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
lastRSS = feed.xml();
|
lastRSS = feed.xml();
|
||||||
|
|||||||
+2
-2
@@ -92,7 +92,7 @@ module.exports = (config) => {
|
|||||||
realPath: path.join(config['data_dir'], p[0], p[1], p[2], p[3]),
|
realPath: path.join(config['data_dir'], p[0], p[1], p[2], p[3]),
|
||||||
year: parseInt(p[0]),
|
year: parseInt(p[0]),
|
||||||
month: parseInt(p[1]),
|
month: parseInt(p[1]),
|
||||||
day: parseInt(p[2])
|
day: parseInt(p[2]),
|
||||||
};
|
};
|
||||||
article.date = new Date(article.year, article.month, article.day);
|
article.date = new Date(article.year, article.month, article.day);
|
||||||
article.date.setUTCHours(0);
|
article.date.setUTCHours(0);
|
||||||
@@ -116,6 +116,6 @@ module.exports = (config) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
+5
-5
@@ -112,9 +112,9 @@ module.exports = (config) => {
|
|||||||
MathJax: {
|
MathJax: {
|
||||||
tex2jax: {
|
tex2jax: {
|
||||||
inlineMath: [['$', '$']],
|
inlineMath: [['$', '$']],
|
||||||
displayMath: [['$$', '$$']]
|
displayMath: [['$$', '$$']],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ module.exports = (config) => {
|
|||||||
const mjConf = {
|
const mjConf = {
|
||||||
math: eq,
|
math: eq,
|
||||||
format: format,
|
format: format,
|
||||||
speakText: config['mathjax']['speak_text']
|
speakText: config['mathjax']['speak_text'],
|
||||||
};
|
};
|
||||||
mjConf[output] = true;
|
mjConf[output] = true;
|
||||||
mjAPI.typeset(mjConf, (res) => {
|
mjAPI.typeset(mjConf, (res) => {
|
||||||
@@ -222,7 +222,7 @@ module.exports = (config) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -163,7 +163,7 @@ describe('Test root path', () => {
|
|||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, '2019', '05', '05'),
|
path.join(dataDir, '2019', '05', '05'),
|
||||||
path.join(dataDir, '2018', '05', '05'),
|
path.join(dataDir, '2018', '05', '05'),
|
||||||
path.join(dataDir, '2017', '05', '05')
|
path.join(dataDir, '2017', '05', '05'),
|
||||||
]);
|
]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'draft.md'),
|
path.join(dataDir, '2019', '05', '05', 'draft.md'),
|
||||||
@@ -219,11 +219,11 @@ describe('Test RSS feed', () => {
|
|||||||
test('200 2 rss items', (done, fail) => {
|
test('200 2 rss items', (done, fail) => {
|
||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, '2019', '05', '05'),
|
path.join(dataDir, '2019', '05', '05'),
|
||||||
path.join(dataDir, '2018', '05', '05')
|
path.join(dataDir, '2018', '05', '05'),
|
||||||
]);
|
]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, '2018', '05', '05', 'index.md')
|
path.join(dataDir, '2018', '05', '05', 'index.md'),
|
||||||
]);
|
]);
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
request(app).get('/rsstest').then((response) => {
|
request(app).get('/rsstest').then((response) => {
|
||||||
@@ -238,12 +238,12 @@ describe('Test RSS feed', () => {
|
|||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, '2019', '05', '05'),
|
path.join(dataDir, '2019', '05', '05'),
|
||||||
path.join(dataDir, '2018', '05', '05'),
|
path.join(dataDir, '2018', '05', '05'),
|
||||||
path.join(dataDir, '2017', '05', '05')
|
path.join(dataDir, '2017', '05', '05'),
|
||||||
]);
|
]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, '2018', '05', '05', 'index.md'),
|
path.join(dataDir, '2018', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, '2017', '05', '05', 'index.md')
|
path.join(dataDir, '2017', '05', '05', 'index.md'),
|
||||||
]);
|
]);
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
request(app).get('/rsstest').then((response) => {
|
request(app).get('/rsstest').then((response) => {
|
||||||
@@ -265,10 +265,10 @@ describe('Test webhook', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
test('200 no secret', (done) => {
|
test('200 no secret', (done) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, testTemplate)
|
path.join(dataDir, testTemplate),
|
||||||
]);
|
]);
|
||||||
config['webhook']['pull_command'] = 'git --help';
|
config['webhook']['pull_command'] = 'git --help';
|
||||||
request(app).post('/webhooktest').then((response) => {
|
request(app).post('/webhooktest').then((response) => {
|
||||||
@@ -280,10 +280,10 @@ describe('Test webhook', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
test('500 command failed', (done) => {
|
test('500 command failed', (done) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, testTemplate)
|
path.join(dataDir, testTemplate),
|
||||||
]);
|
]);
|
||||||
config['webhook']['pull_command'] = 'qzgfqgqz';
|
config['webhook']['pull_command'] = 'qzgfqgqz';
|
||||||
request(app).post('/webhooktest').then((response) => {
|
request(app).post('/webhooktest').then((response) => {
|
||||||
@@ -322,7 +322,7 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('500 fail to render', (done, fail) => {
|
test('500 fail to render', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
||||||
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- articl.content %><%- `<a href="${article.url}">reload</a>` %>');
|
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- articl.content %><%- `<a href="${article.url}">reload</a>` %>');
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
@@ -334,7 +334,7 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('500 no template', (done, fail) => {
|
test('500 no template', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
request(app).get('/2019/05/05/hello/').then((response) => {
|
request(app).get('/2019/05/05/hello/').then((response) => {
|
||||||
@@ -345,7 +345,7 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('200 rendered article', (done, fail) => {
|
test('200 rendered article', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'index.md'), '# Hello');
|
||||||
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- article.content %><%- `<a href="${article.url}">reload</a>` %>');
|
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- article.content %><%- `<a href="${article.url}">reload</a>` %>');
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
@@ -358,7 +358,7 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('200 rendered draft', (done, fail) => {
|
test('200 rendered draft', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'draft.md'), '# Hello');
|
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'draft.md'), '# Hello');
|
||||||
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- article.content %><%- `<a href="${article.url}">reload</a>` %>');
|
fs.writeFileSync(path.join(dataDir, testTemplate), '<%- article.content %><%- `<a href="${article.url}">reload</a>` %>');
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
@@ -371,10 +371,10 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('200 other url', (done, fail) => {
|
test('200 other url', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, testTemplate)
|
path.join(dataDir, testTemplate),
|
||||||
]);
|
]);
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
request(app).get('/2019/05/05/anything/').then((response) => {
|
request(app).get('/2019/05/05/anything/').then((response) => {
|
||||||
@@ -385,10 +385,10 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('200 other url 2', (done, fail) => {
|
test('200 other url 2', (done, fail) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
path.join(dataDir, testTemplate)
|
path.join(dataDir, testTemplate),
|
||||||
]);
|
]);
|
||||||
app.reload(() => {
|
app.reload(() => {
|
||||||
request(app).get('/2019/05/05/').then((response) => {
|
request(app).get('/2019/05/05/').then((response) => {
|
||||||
@@ -441,7 +441,7 @@ describe('Test static files', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
test('200 valid resource of article', (done) => {
|
test('200 valid resource of article', (done) => {
|
||||||
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05'),]);
|
utils.createEmptyDirs([path.join(dataDir, '2019', '05', '05')]);
|
||||||
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'somefile.txt'), 'filecontent');
|
fs.writeFileSync(path.join(dataDir, '2019', '05', '05', 'somefile.txt'), 'filecontent');
|
||||||
request(app).get('/2019/05/05/title/somefile.txt').then((response) => {
|
request(app).get('/2019/05/05/title/somefile.txt').then((response) => {
|
||||||
expect(response.statusCode).toBe(200);
|
expect(response.statusCode).toBe(200);
|
||||||
|
|||||||
+13
-13
@@ -15,8 +15,8 @@ const config = {
|
|||||||
'draft': 'draft.md',
|
'draft': 'draft.md',
|
||||||
'default_title': 'Untitled',
|
'default_title': 'Untitled',
|
||||||
'default_thumbnail': 'default.png',
|
'default_thumbnail': 'default.png',
|
||||||
'thumbnail_tag': 'thumbnail'
|
'thumbnail_tag': 'thumbnail',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const fw = require('../src/file_walker')(config);
|
const fw = require('../src/file_walker')(config);
|
||||||
@@ -46,7 +46,7 @@ describe('Test function fileTree', () => {
|
|||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, 'test', 'test'),
|
path.join(dataDir, 'test', 'test'),
|
||||||
path.join(dataDir, 'test', 'test2'),
|
path.join(dataDir, 'test', 'test2'),
|
||||||
path.join(dataDir, 'test2')
|
path.join(dataDir, 'test2'),
|
||||||
]);
|
]);
|
||||||
fw.fileTree(dataDir, (err, list) => {
|
fw.fileTree(dataDir, (err, list) => {
|
||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
@@ -58,7 +58,7 @@ describe('Test function fileTree', () => {
|
|||||||
test('simple files', (done) => {
|
test('simple files', (done) => {
|
||||||
const fileList = [
|
const fileList = [
|
||||||
path.join(dataDir, 'f1.txt'),
|
path.join(dataDir, 'f1.txt'),
|
||||||
path.join(dataDir, 'f2.txt')
|
path.join(dataDir, 'f2.txt'),
|
||||||
];
|
];
|
||||||
utils.createEmptyFiles(fileList);
|
utils.createEmptyFiles(fileList);
|
||||||
fw.fileTree(dataDir, (err, list) => {
|
fw.fileTree(dataDir, (err, list) => {
|
||||||
@@ -72,13 +72,13 @@ describe('Test function fileTree', () => {
|
|||||||
test('nested files', (done) => {
|
test('nested files', (done) => {
|
||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, 'test', 'test'),
|
path.join(dataDir, 'test', 'test'),
|
||||||
path.join(dataDir, 'test2')
|
path.join(dataDir, 'test2'),
|
||||||
]);
|
]);
|
||||||
const fileList = [
|
const fileList = [
|
||||||
path.join(dataDir, 'f1.txt'),
|
path.join(dataDir, 'f1.txt'),
|
||||||
path.join(dataDir, 'test', 'f2.txt'),
|
path.join(dataDir, 'test', 'f2.txt'),
|
||||||
path.join(dataDir, 'test', 'test', 'f3.txt'),
|
path.join(dataDir, 'test', 'test', 'f3.txt'),
|
||||||
path.join(dataDir, 'test2', 'f4.txt')
|
path.join(dataDir, 'test2', 'f4.txt'),
|
||||||
];
|
];
|
||||||
utils.createEmptyFiles(fileList);
|
utils.createEmptyFiles(fileList);
|
||||||
fw.fileTree(dataDir, (err, list) => {
|
fw.fileTree(dataDir, (err, list) => {
|
||||||
@@ -120,7 +120,7 @@ describe('Test index article reading', () => {
|
|||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
expect(info).toEqual({
|
expect(info).toEqual({
|
||||||
title: 'This is an awesome title !?¤',
|
title: 'This is an awesome title !?¤',
|
||||||
thumbnail: './thumbnail.jpg'
|
thumbnail: './thumbnail.jpg',
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -136,7 +136,7 @@ describe('Test index article reading', () => {
|
|||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
expect(info).toEqual({
|
expect(info).toEqual({
|
||||||
title: undefined,
|
title: undefined,
|
||||||
thumbnail: './thumbnail.jpg'
|
thumbnail: './thumbnail.jpg',
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -148,7 +148,7 @@ describe('Test index article reading', () => {
|
|||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
expect(info).toEqual({
|
expect(info).toEqual({
|
||||||
title: 'title',
|
title: 'title',
|
||||||
thumbnail: undefined
|
thumbnail: undefined,
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -164,7 +164,7 @@ describe('Test index article reading', () => {
|
|||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
expect(info).toEqual({
|
expect(info).toEqual({
|
||||||
title: 'This is an awesome title !?¤',
|
title: 'This is an awesome title !?¤',
|
||||||
thumbnail: undefined
|
thumbnail: undefined,
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -181,7 +181,7 @@ describe('Test index article reading', () => {
|
|||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
expect(info).toEqual({
|
expect(info).toEqual({
|
||||||
title: 'This is an awesome title !?¤',
|
title: 'This is an awesome title !?¤',
|
||||||
thumbnail: './thumbnail.jpg'
|
thumbnail: './thumbnail.jpg',
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -208,12 +208,12 @@ describe('Test article fetching', () => {
|
|||||||
test('misplaced index file', (done) => {
|
test('misplaced index file', (done) => {
|
||||||
utils.createEmptyDirs([
|
utils.createEmptyDirs([
|
||||||
path.join(dataDir, 'test', 'test'),
|
path.join(dataDir, 'test', 'test'),
|
||||||
path.join(dataDir, '2019', '05', '05')
|
path.join(dataDir, '2019', '05', '05'),
|
||||||
]);
|
]);
|
||||||
utils.createEmptyFiles([
|
utils.createEmptyFiles([
|
||||||
path.join(dataDir, testIndex),
|
path.join(dataDir, testIndex),
|
||||||
path.join(dataDir, 'test', 'test', testIndex),
|
path.join(dataDir, 'test', 'test', testIndex),
|
||||||
path.join(dataDir, '2019', '05', testIndex)
|
path.join(dataDir, '2019', '05', testIndex),
|
||||||
]);
|
]);
|
||||||
fw.fetchArticles((err, dict) => {
|
fw.fetchArticles((err, dict) => {
|
||||||
expect(err).toBeNull();
|
expect(err).toBeNull();
|
||||||
|
|||||||
+10
-10
@@ -15,15 +15,15 @@ const config = {
|
|||||||
},
|
},
|
||||||
'showdown': {
|
'showdown': {
|
||||||
'simplifiedAutoLink': true,
|
'simplifiedAutoLink': true,
|
||||||
'smartIndentationFix': true
|
'smartIndentationFix': true,
|
||||||
},
|
},
|
||||||
'mathjax': {
|
'mathjax': {
|
||||||
'output_format': 'html',
|
'output_format': 'html',
|
||||||
'speak_text': false
|
'speak_text': false,
|
||||||
},
|
},
|
||||||
'plantuml': {
|
'plantuml': {
|
||||||
'output_format': 'svg'
|
'output_format': 'svg',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderer = require('../src/renderer')(config);
|
const renderer = require('../src/renderer')(config);
|
||||||
@@ -48,7 +48,7 @@ describe('get parts', () => {
|
|||||||
const data = 'Hello\nthere\ngeneral\nkenobi';
|
const data = 'Hello\nthere\ngeneral\nkenobi';
|
||||||
const parts = renderer.getParts(data);
|
const parts = renderer.getParts(data);
|
||||||
expect(parts.map(p => p.text)).toEqual([
|
expect(parts.map(p => p.text)).toEqual([
|
||||||
'Hello\nthere\ngeneral\nkenobi'
|
'Hello\nthere\ngeneral\nkenobi',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
test('lot of stuff', () => {
|
test('lot of stuff', () => {
|
||||||
@@ -58,27 +58,27 @@ describe('get parts', () => {
|
|||||||
{
|
{
|
||||||
index: 0,
|
index: 0,
|
||||||
end: 12,
|
end: 12,
|
||||||
text: 'Hello\nthere\n'
|
text: 'Hello\nthere\n',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 22,
|
index: 22,
|
||||||
end: 30,
|
end: 30,
|
||||||
text: '\ngeneral'
|
text: '\ngeneral',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 53,
|
index: 53,
|
||||||
end: 54,
|
end: 54,
|
||||||
text: '\n'
|
text: '\n',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 78,
|
index: 78,
|
||||||
end: 79,
|
end: 79,
|
||||||
text: '\n'
|
text: '\n',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 109,
|
index: 109,
|
||||||
end: 115,
|
end: 115,
|
||||||
text: 'kenobi'
|
text: 'kenobi',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user