-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Update proxy.js to auto strip double quotes/spaces if any (#1283)
- Loading branch information
1 parent
6571d4a
commit b35c2dd
Showing
4 changed files
with
60 additions
and
3 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
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,31 @@ | ||
import { stripQuotesAndSpaces } from '@percy/env/utils'; | ||
|
||
describe('stripQuotesAndSpaces', () => { | ||
it('should remove leading and trailing spaces', () => { | ||
const line = ' this is a line with spaces '; | ||
const expected = 'this is a line with spaces'; | ||
const actual = stripQuotesAndSpaces(line); | ||
expect(actual).toBe(expected); | ||
}); | ||
|
||
it('should remove leading and trailing double quotes', () => { | ||
const line = '"this is a line with double quotes"'; | ||
const expected = 'this is a line with double quotes'; | ||
const actual = stripQuotesAndSpaces(line); | ||
expect(actual).toBe(expected); | ||
}); | ||
|
||
it('should remove both leading and trailing spaces and double quotes', () => { | ||
const line = '" this is a line with spaces and double quotes "'; | ||
const expected = 'this is a line with spaces and double quotes'; | ||
const actual = stripQuotesAndSpaces(line); | ||
expect(actual).toBe(expected); | ||
}); | ||
|
||
it('should return null if line is null', () => { | ||
const line = null; | ||
const expected = null; | ||
const actual = stripQuotesAndSpaces(line); | ||
expect(actual).toBe(expected); | ||
}); | ||
}); |