-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8184394
commit 6c22637
Showing
1 changed file
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]})))) | ||
}) | ||
}) |