-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
44 lines (39 loc) · 1.03 KB
/
test.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
44
const fs = require('fs')
const MarkdownIt = require('markdown-it')
const meta = require('markdown-it-meta')
const glob = require('glob')
const assert = require('assert')
const md = new MarkdownIt()
md.use(meta)
var jaWIPs = []
var enWIPs = []
function jaTask (cb) {
glob("ja/**/*.md", {}, function (err, files) {
files.forEach(function (path) {
var data = fs.readFileSync(path)
md.render(data.toString('utf-8', 0, data.length))
if(md.meta.WIP) jaWIPs.push(path.replace('ja/', ''))
})
cb()
})
}
function enTask (cb) {
glob("en/**/*.md", {}, function (err, files) {
files.forEach(function (path) {
var data = fs.readFileSync(path)
md.render(data.toString('utf-8', 0, data.length))
if(md.meta.WIP) enWIPs.push(path.replace('en/', ''))
})
cb()
})
}
describe('en & ja', function () {
it('should be same.', function (done) {
jaTask(function () {
enTask(function () {
assert.deepEqual({ja: jaWIPs, en: enWIPs}, {ja:[], en:[]})
done()
})
})
})
})