Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Jul 7, 2020
1 parent 166d504 commit 81ad080
Show file tree
Hide file tree
Showing 6 changed files with 1,353 additions and 178 deletions.
10 changes: 5 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@bifravst/eslint-config-typescript",
"rules": {
"@typescript-eslint/indent": "warn"
}
}
"extends": "@bifravst/eslint-config-typescript",
"rules": {
"@typescript-eslint/indent": "warn"
}
}
32 changes: 14 additions & 18 deletions feature-runner/run-features.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {
FeatureRunner,
fetchStackConfiguration,
ConsoleReporter,
appSyncStepRunners,
appSyncAfterAll,
appSyncBeforeAll,
webhookStepRunners,
randomStepRunners,
} from '@coderbyheart/bdd-feature-runner-aws'
} from '@bifravst/e2e-bdd-test-runner'
import { stackOutput } from '@bifravst/cloudformation-helpers'
import { CloudFormation } from 'aws-sdk'
import * as chalk from 'chalk'
import * as program from 'commander'
import { StackConfig } from '../aws/stacks/core'
Expand All @@ -30,19 +31,19 @@ export type World = {
sendGridReceiverQueueURL: string
keyId: string
privateKey: string
webhookQueue: string
}

const region = process.env.AWS_REGION || ''
const keyId = process.env.KEY_ID || ''
const region = process.env.AWS_REGION ?? ''
const keyId = process.env.KEY_ID ?? ''
const privateKey = fs
.readFileSync(
path.join(process.cwd(), `ecdsa-p256-${keyId}-private.pem`),
'utf-8',
)
.toString()
const sendGridApiKey = process.env.SENDGRID_API_KEY || ''
const sendGridDomainName = process.env.SENDGRID_DOMAIN || ''
const sendGridApiKey = process.env.SENDGRID_API_KEY ?? ''
const sendGridDomainName = process.env.SENDGRID_DOMAIN ?? ''
const so = stackOutput(new CloudFormation({ region }))

program
.arguments('<featureDir>')
Expand All @@ -59,14 +60,8 @@ program
ran = true

const [stackConfig, testStackConfig] = await Promise.all([
fetchStackConfiguration({
StackName: stackName(),
region: process.env.AWS_REGION as string,
}) as Promise<StackConfig>,
fetchStackConfiguration({
StackName: stackName('test-extras'),
region: process.env.AWS_REGION as string,
}) as Promise<TestExtrasStackConfig>,
so<StackConfig>(stackName()),
so<TestExtrasStackConfig>(stackName('test-extras')),
])

const world: World = {
Expand All @@ -82,7 +77,6 @@ program
sendGridReceiverQueueURL: testStackConfig.sendGridReceiverQueueURL,
keyId,
privateKey,
webhookQueue: testStackConfig.sendGridReceiverQueueURL,
}

console.log(chalk.yellow.bold(' World:'))
Expand All @@ -108,14 +102,16 @@ program
.addStepRunners(randomStepRunners())
.addStepRunners(sendGridSteps())
.addStepRunners(
webhookStepRunners<World>({ region }),
webhookStepRunners({
region,
webhookQueue: testStackConfig.sendGridReceiverQueueURL,
}),
)
.run()
await appSyncAfterAll(runner)
await sendGridAfterAll(runner)
if (!success) {
process.exit(1)
return
}
process.exit()
},
Expand Down
11 changes: 4 additions & 7 deletions feature-runner/sendGridSteps.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/*eslint @typescript-eslint/camelcase: "warn"*/

import {
regexGroupMatcher,
FeatureRunner,
} from '@coderbyheart/bdd-feature-runner-aws'
import { regexGroupMatcher, FeatureRunner } from '@bifravst/e2e-bdd-test-runner'
import fetch from 'node-fetch'
import { World } from './run-features'
import { v4 } from 'uuid'
Expand Down Expand Up @@ -44,7 +41,7 @@ export const sendGridSteps = () => [
)
}
runner.store['sendgrid:receivers'] = [
...(runner.store['sendgrid:receivers'] || []),
...(runner.store['sendgrid:receivers'] ?? []),
receiverId,
]
runner.store[storeName] = hostname
Expand All @@ -57,8 +54,8 @@ export const sendGridSteps = () => [
export const sendGridAfterAll = async (runner: FeatureRunner<World>) => {
const { sendGridDomainName, sendGridApiKey } = runner.world
await Promise.all(
((runner.store['sendgrid:receivers'] as string[]) || []).map(
async receiver => {
((runner.store['sendgrid:receivers'] as string[]) ?? []).map(
async (receiver) => {
const res = await fetch(
`https://api.sendgrid.com/v3/user/webhooks/parse/settings/${createHostname(
sendGridDomainName,
Expand Down
2 changes: 1 addition & 1 deletion feature-runner/twilioIntegrationSteps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as jwt from 'jsonwebtoken'
import { regexGroupMatcher } from '@coderbyheart/bdd-feature-runner-aws'
import { regexGroupMatcher } from '@bifravst/e2e-bdd-test-runner'
import { Client } from 'twilio-chat'
import { Channel } from 'twilio-chat/lib/channel'
import { expect } from 'chai'
Expand Down
Loading

0 comments on commit 81ad080

Please sign in to comment.