Skip to content

Commit

Permalink
Rectify bad exports and cognito user pool lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
eoinsha committed Aug 9, 2019
1 parent f48b91b commit d46b3d0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion integration-tests/lib/backend-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { CloudFormation } = require('aws-sdk')

const stage = process.env.SLIC_STAGE || 'local'
const domainSuffix = stage === 'prod' ? '' : `${stage}.`
const stackName = `checklist-service-${stage}`
const stackName = `user-service-${stage}`

let backendConfig

Expand Down
3 changes: 2 additions & 1 deletion integration-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
},
"dependencies": {
"dotenv": "^8.0.0",
"random-words": "^1.1.0",
"test-common": "file:../test-common"
}
}
14 changes: 11 additions & 3 deletions test-common/real-email-config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
'use strict'

const Mailosaur = require('mailosaur')
const RandomWords = require('random-words')

const { MAILOSAUR_SERVER_ID: serverId } = process.env

const client = new Mailosaur(process.env.MAILOSAUR_API_KEY)

export function generateEmailAddress() {
module.exports = {
generateEmailAddress,
retrieveCode,
retrieveEmail
}

function generateEmailAddress() {
return `${RandomWords(3).join('-')}.${serverId}@mailosaur.io`
}

export async function retrieveCode(emailAddress) {
async function retrieveCode(emailAddress) {
const email = await retrieveEmail(emailAddress)
const emailBody = email.html.body
const splitBody = emailBody.split(' ')
const confirmationCode = splitBody[splitBody.length - 1]
return confirmationCode
}

export function retrieveEmail(emailAddress) {
function retrieveEmail(emailAddress) {
return client.messages.waitFor(process.env.MAILOSAUR_SERVER_ID, {
sentTo: emailAddress
})
Expand Down

0 comments on commit d46b3d0

Please sign in to comment.