Merge pull request #5 from electron/all-docs-not-just-api-docs

fetch all docs, not just API docs
This commit is contained in:
Zeke Sikelianos 2016-12-16 12:55:56 -08:00 коммит произвёл GitHub
Родитель 3fbc0dde6c d935085cb0
Коммит 6ff9454b99
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -35,9 +35,10 @@ function download (version, callback) {
} }
}) })
.on('finish', function extracted () { .on('finish', function extracted () {
readFromDisk(path.join(electronDir, 'docs', 'api'), callback) readFromDisk(path.join(electronDir, 'docs'), callback)
}) })
console.log(`Downloading ${tarballUrl}`)
got.stream(tarballUrl) got.stream(tarballUrl)
.pipe(gunzip()) .pipe(gunzip())
.pipe(extractor) .pipe(extractor)

Просмотреть файл

@ -4,7 +4,7 @@ const semver = require('semver')
const electronDocs = require('..') const electronDocs = require('..')
test('electronDocs', {timeout: 30 * 1000}, function (t) { test('electronDocs', {timeout: 30 * 1000}, function (t) {
t.plan(11) t.plan(13)
electronDocs('master').then(function (docs) { electronDocs('master').then(function (docs) {
t.comment('fetch by branch name') t.comment('fetch by branch name')
@ -12,6 +12,11 @@ test('electronDocs', {timeout: 30 * 1000}, function (t) {
t.ok(docs.every(doc => doc.filename.length > 0), 'every doc has a filename property') t.ok(docs.every(doc => doc.filename.length > 0), 'every doc has a filename property')
t.ok(docs.every(doc => doc.slug.length > 0), 'every doc has a slug property') t.ok(docs.every(doc => doc.slug.length > 0), 'every doc has a slug property')
t.ok(docs.every(doc => doc.markdown_content.length > 0), 'every doc has a markdown_content property') t.ok(docs.every(doc => doc.markdown_content.length > 0), 'every doc has a markdown_content property')
// console.log(docs.map(doc => doc.filename))
t.comment('non-API files are included')
t.ok(docs.find(doc => doc.filename === 'styleguide.md'), 'styleguide.md')
t.ok(docs.find(doc => doc.filename === 'tutorial/about.md'), 'tutorial/about.md')
}) })
electronDocs('1.2.0').then(function (docs) { electronDocs('1.2.0').then(function (docs) {