-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3da7ed6
commit 05fe801
Showing
3 changed files
with
42 additions
and
5 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
31 changes: 31 additions & 0 deletions
31
web/client/components/catalog/editor/__tests__/MainFormUtils-test.js
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 expect from "expect"; | ||
|
||
import { isValidURL } from '../MainFormUtils'; | ||
|
||
describe('Catalog Main Form Editor Utils', () => { | ||
it('isValidURL', () => { | ||
const URLS = [ | ||
// http | ||
['http://myDomain.com/geoserver/wms', 'https://myMapStore.com/geoserver/wms', false], | ||
['http://myDomain.com/geoserver/wms', 'http://myMapStore.com/geoserver/wms', true], | ||
// https | ||
['https://myDomain.com/geoserver/wms', 'http://myMapStore.com/geoserver/wms', true], | ||
['https://myDomain.com/geoserver/wms', 'https://myMapStore.com/geoserver/wms', true], | ||
// protocol relative URL | ||
['//myDomain.com/geoserver/wms', 'http://myMapStore.com/geoserver/wms', true], | ||
['//myDomain.com/geoserver/wms', 'https://myMapStore.com/geoserver/wms', true], | ||
// absolute path | ||
['/geoserver/wms', 'http://myMapStore.com/geoserver/wms', true], | ||
['/geoserver/wms', 'https://myMapStore.com/geoserver/wms', true], | ||
// relative path | ||
["geoserver/wms", "http://myMapStore.com/geoserver/wms", true], | ||
["geoserver/wms", "https://myMapStore.com/geoserver/wms", true] | ||
|
||
|
||
]; | ||
URLS.forEach(([catalogURL, locationURL, valid]) => { | ||
const result = isValidURL(catalogURL, locationURL); | ||
expect(!!result).toEqual(!!valid, `${catalogURL} - added when location is ${locationURL} should be ${valid}, but it is ${result}`); | ||
}); | ||
}); | ||
}); |