Skip to content

Commit

Permalink
fix download pages test and rearrange download spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
thejmazz committed Sep 27, 2016
1 parent b62aede commit 33830eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 33 deletions.
21 changes: 0 additions & 21 deletions test/download-all.spec.js

This file was deleted.

23 changes: 11 additions & 12 deletions test/download-page.spec.js → test/download.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ chai.use(chaiAsPromised)
const { assert, should } = chai
should()

const { downloadPage, getTeamPages } = require('../index.js')({ teamName: 'Toronto' })
const { getTeamPages, downloadPage, downloadAll } = require('../index.js')({ teamName: 'Toronto' })

describe('Download page', function() {
describe('Download', function() {
it('Should download all pages from getTeamPages', function() {
this.timeout(15 * 1000)

const dir = path.resolve(__dirname, 'download')

let expectedLength

return getTeamPages()
.then((pages) => {
expectedLength = pages.length

return Promise.all(pages.map(page => downloadPage({ page, dir })))
})
.then(() => fs.readdirAsync(dir))
.then((files) => {
assert.isOk(files.length === expectedLength, 'Did not download all pages')
})
.then(pages => Promise.all(pages.map(page => downloadPage({ page, dir }))))
})

it('Should download all pages and templates', function() {
this.timeout(30 * 1000)

return downloadAll({ dir: path.resolve(__dirname, './download') }).then((results) => {
console.log('results: ', results)
})
})
})

0 comments on commit 33830eb

Please sign in to comment.