Skip to content

Commit

Permalink
test(push): Fix push to s3 test
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorgerhardt committed Apr 3, 2017
1 parent 8184394 commit 6c22637
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions __tests__/lib/push-to-s3.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
/* global describe, it */

const fs = require('fs')
const path = require('path')

const BUILD_DIR = path.join(process.cwd(), '__tests__/test-utils/tmp')
const MOCK_DIR = path.join(process.cwd(), '__tests__/test-utils/mocks')
const files = [
[`${MOCK_DIR}/index.js`, `${BUILD_DIR}/index.js`],
[`${MOCK_DIR}/index.css`, `${BUILD_DIR}/index.css`]
]

describe('lib > push to s3', () => {
const configPush = require('../../lib/push-to-s3')
const build = require('../../lib/build')
const createPushToS3 = require('../../lib/push-to-s3')
const loadConfig = require('../../lib/load-config')

it('should compile JavaScript and CSS and send to s3 via aws-sdk', () => {
const config = loadConfig(process.cwd(), 'configurations/default', 'development')
const push = configPush({
const push = createPushToS3({
env: 'development',
config,
minify: false,
s3bucket: 'test-bucket'
})
return Promise.all([
push([`${MOCK_DIR}/index.js`, `${BUILD_DIR}/index.js`]),
push([`${MOCK_DIR}/index.css`, `${BUILD_DIR}/index.css`])
])
return build({
config,
env: 'development',
files
}).then(() =>
Promise.all(files.map((f) =>
push({body: fs.readFileSync(f[0]), outfile: f[0]}))))
})
})

0 comments on commit 6c22637

Please sign in to comment.