-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into codedeploy-assertions
- Loading branch information
Showing
46 changed files
with
1,173 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { filterLogicalId, formatFailure, matchSection } from './section'; | ||
import { Template } from './template'; | ||
|
||
export function findConditions(template: Template, logicalId: string, props: any = {}): { [key: string]: { [key: string]: any } } { | ||
const section: { [key: string] : {} } = template.Conditions; | ||
const result = matchSection(filterLogicalId(section, logicalId), props); | ||
|
||
if (!result.match) { | ||
return {}; | ||
} | ||
|
||
return result.matches; | ||
} | ||
|
||
export function hasCondition(template: Template, logicalId: string, props: any): string | void { | ||
const section: { [key: string] : {} } = template.Conditions; | ||
const result = matchSection(filterLogicalId(section, logicalId), props); | ||
if (result.match) { | ||
return; | ||
} | ||
|
||
if (result.closestResult === undefined) { | ||
return 'No conditions found in the template'; | ||
} | ||
|
||
return [ | ||
`Template has ${result.analyzedCount} conditions, but none match as expected.`, | ||
formatFailure(result.closestResult), | ||
].join('\n'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.