-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rewrite-pattern): multiple rewrite pattern and substitution support #418
Closed
Closed
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5e0dec0
Update code-style-lint.yml
dougtoppin c6e3c5f
Update cdk-nag.yml
dougtoppin d4c7519
Update codeql.yml
dougtoppin 8a4af20
Update run-unit-test.yml
dougtoppin 4cb412e
Create .viperlightignore
dougtoppin d0bebab
Create .viperlightrc
dougtoppin 1cc9014
Update code-style-lint.yml
dougtoppin 1667de7
Update code-style-lint.yml
dougtoppin 63c5e32
Merge branch 'aws-solutions:develop' into develop
dougtoppin 64fedd9
Initial testing of PR 399 submission
3444d62
Add PR #399 multiple rewrite support and unit tests
69b05da
restore code-style-lint to previous version
657cb25
restore to previous version
3410c62
Merge pull request #1 from dougtoppin/feature/399-multiple-rewrite
dougtoppin 860d9ee
add detail to test description
9c4702d
Merge branch 'aws-solutions:develop' into develop
dougtoppin 6335cc6
Merge branch 'aws-solutions:develop' into develop
dougtoppin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { isNullOrWhiteSpace, parseJson, generateRegExp } from "../helpers"; | ||
|
||
describe("helpers", () => { | ||
it("Should pass if the proper result is returned for a whitespace only string", () => { | ||
const result = isNullOrWhiteSpace(" "); | ||
|
||
const expectedResult = true; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for a null string", () => { | ||
const result = isNullOrWhiteSpace(""); | ||
|
||
const expectedResult = true; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for non-whitespace containing string", () => { | ||
const result = isNullOrWhiteSpace("abc"); | ||
|
||
const expectedResult = false; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for a singe entry", () => { | ||
const result = parseJson("filter:"); | ||
|
||
const expectedResult = ["filter:"]; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for a null string", () => { | ||
const result = parseJson(""); | ||
|
||
const expectedResult = [""]; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for json with multiple objects", () => { | ||
const result = parseJson('["//thumb/g","//small/g","//large/g"]'); | ||
|
||
const expectedResult = ["//thumb/g", "//small/g", "//large/g"]; | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for a simple regex", () => { | ||
const result = generateRegExp("/thumb/g"); | ||
|
||
const expectedResult1 = /thumb/g; | ||
expect(result).toEqual(expectedResult1); | ||
}); | ||
|
||
it("Should pass if the proper result is returned for a simple rege with embedded slash that must be escaped", () => { | ||
const result = generateRegExp("//thumb/g"); | ||
|
||
const expectedResult1 = /\/thumb/g; | ||
expect(result).toEqual(expectedResult1); | ||
}); | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returning array?