Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
fix(npm): remove dependency to @bifravst/cloudformation-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Jan 22, 2021
1 parent 94bc6a1 commit b43cb4f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions feature-runner/steps/bifravst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
StepRunnerFunc,
InterpolatedStep,
} from '@bifravst/e2e-bdd-test-runner'
import { BifravstWorld } from '../run-features'
import { randomWords } from '@bifravst/random-words'
import { createDeviceCertificate } from '../../cli/jitp/createDeviceCertificate'
import { device, thingShadow } from 'aws-iot-device-sdk'
Expand Down Expand Up @@ -65,6 +64,10 @@ const shadow = ({
})
}

type World = {
accountId: string
}

export const bifravstStepRunners = ({
mqttEndpoint,
certsDir,
Expand All @@ -73,7 +76,7 @@ export const bifravstStepRunners = ({
mqttEndpoint: string
certsDir: string
awsIotRootCA: string
}): ((step: InterpolatedStep) => StepRunnerFunc<BifravstWorld> | false)[] => {
}): ((step: InterpolatedStep) => StepRunnerFunc<World> | false)[] => {
const connectToBroker = connect({
mqttEndpoint,
certsDir,
Expand All @@ -85,7 +88,7 @@ export const bifravstStepRunners = ({
awsIotRootCA,
})
return [
regexMatcher<BifravstWorld>(
regexMatcher<World>(
/^(?:a cat exists|I generate a certificate)(?: for the cat tracker "([^"]+)")?$/,
)(async ([deviceId], __, runner) => {
const catId = deviceId ?? (await randomWords({ numWords: 3 })).join('-')
Expand Down Expand Up @@ -124,7 +127,7 @@ export const bifravstStepRunners = ({
}
return runner.store[`${prefix}:id`]
}),
regexMatcher<BifravstWorld>(/^I connect the cat tracker(?: ([^ ]+))?$/)(
regexMatcher<World>(/^I connect the cat tracker(?: ([^ ]+))?$/)(
async ([deviceId], __, runner) => {
const catId = deviceId ?? runner.store['cat:id']
await runner.progress('IoT', catId)
Expand Down Expand Up @@ -162,7 +165,7 @@ export const bifravstStepRunners = ({
})
},
),
regexMatcher<BifravstWorld>(
regexMatcher<World>(
/^the cat tracker(?: ([^ ]+))? updates its reported state with$/,
)(async ([deviceId], step, runner) => {
if (step.interpolatedArgument === undefined) {
Expand Down Expand Up @@ -204,7 +207,7 @@ export const bifravstStepRunners = ({
})
return await updatePromise
}),
regexMatcher<BifravstWorld>(
regexMatcher<World>(
/^the cat tracker(?: ([^ ]+))? publishes this message to the topic ([^ ]+)$/,
)(async ([deviceId, topic], step, runner) => {
const catId = deviceId ?? runner.store['cat:id']
Expand Down

0 comments on commit b43cb4f

Please sign in to comment.