new server test with precommit hook to secure .env files, set up CI environment (#5)

* new server test with precommit hook to secure .env files, set up CI environment (#3)

* [TESTS] added all registered routes to api server test

* [WIP] abstracting config to env where it makes sense, refactoring elsewhere, adding more tests

* [WIP] fixed tests so they fail as expected

* [WIP]

* [DEBUG] fixed issues with the env configuration, added correct tests

* [MISC] env didn't get readded on last precommit

* [TESTS] added longer wait time for server as sometimtimes tests fail arbitrarily
This commit is contained in:
Joshua
2018-12-14 15:59:12 +00:00
committed by GitHub
parent 1515f17461
commit 5f4943d1d5
15 changed files with 351 additions and 44 deletions

View File

@@ -1,13 +1,13 @@
import StoreJson from './models/StoreJson'
import Fetcher from './lib/Fetcher'
import Controller from './lib/Controller'
import config from './config'
import sheetsConfig from './sheets_config'
const { googleSheets } = config
const { sheets, privateKey, email } = googleSheets
const { googleSheets } = sheetsConfig
const { sheets } = googleSheets
function authenticate (_fetcher) {
return _fetcher.fetcher.authenticate(email, privateKey).then(msg => {
return _fetcher.fetcher.authenticate(process.env.SERVICE_ACCOUNT_EMAIL, process.env.SERVICE_ACCOUNT_PRIVATE_KEY).then(msg => {
console.log(msg)
return true
})
@@ -24,7 +24,7 @@ export default callback => {
Promise.all(fetchers.map(authenticate))
.then(() => {
console.log(`===================`)
console.log(`grant access to: ${email}`)
console.log(`grant access to: ${process.env.SERVICE_ACCOUNT_EMAIL}`)
console.log(`===================`)
// NB: reformat fetchers as config for controller
@@ -39,7 +39,7 @@ export default callback => {
console.log(err)
console.log(
`ERROR: the server couldn't connect to all of the sheets you provided. Ensure you have granted access to ${
email
process.env.SERVICE_ACCOUNT_EMAIL
} on ALL listed sheets.`
)
})