Skip to content

Commit

Permalink
Add registration to goal test
Browse files Browse the repository at this point in the history
[changelog:added]
  • Loading branch information
cdupuis committed Feb 1, 2020
1 parent b924455 commit db15c06
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/api/mapping/goalTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ export interface GoalTest extends PushTest {
pushTest: PushTest;
}

export function isGoal(options: { name?: RegExp, state?: SdmGoalState, output?: RegExp, pushTest?: PushTest, data?: RegExp } = {}): GoalTest {
export function isGoal(options: {
name?: RegExp,
registration?: RegExp,
state?: SdmGoalState,
output?: RegExp,
pushTest?: PushTest,
data?: RegExp
} = {}): GoalTest {
return goalTest(
`is goal ${JSON.stringify(options)}`,
async g => {
if (!!options.name && !options.name.test(g.name)) {
return false;
}
if (!!options.registration && !options.registration.test(g.registration)) {
return false;
}
if (!!options.state && options.state !== g.state) {
return false;
}
Expand Down

0 comments on commit db15c06

Please sign in to comment.