aboutsummaryrefslogtreecommitdiff
path: root/test/shared
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-11-11 03:31:58 +0000
committerGitHub <noreply@github.com>2019-11-11 03:31:58 +0000
commitae77b386f4da2cbd46c45fe6fece58a5e521fff5 (patch)
treec5ea2e8c001399a385f99c05c7790eb23df9ccae /test/shared
parentf93ed4149b1a88d0e887fc8270239e0a28ee23db (diff)
parentddd3b08a4a3b393375b6e9716697b9442fcfa66d (diff)
Merge pull request #666 from chen-chao/localhost
support url started with localhost
Diffstat (limited to 'test/shared')
-rw-r--r--test/shared/urls.test.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/shared/urls.test.ts b/test/shared/urls.test.ts
index 3a3eea6..6206d03 100644
--- a/test/shared/urls.test.ts
+++ b/test/shared/urls.test.ts
@@ -36,6 +36,21 @@ describe("shared/commands/parsers", () => {
expect(parsers.searchUrl('std::vector', config))
.to.equal('https://google.com/search?q=std%3A%3Avector');
});
+
+ it('localhost urls', () => {
+ expect(parsers.searchUrl('localhost', config))
+ .to.equal('http://localhost');
+ expect(parsers.searchUrl('http://localhost', config))
+ .to.equal('http://localhost/');
+ expect(parsers.searchUrl('localhost:8080', config))
+ .to.equal('http://localhost:8080');
+ expect(parsers.searchUrl('localhost:80nan', config))
+ .to.equal('https://google.com/search?q=localhost%3A80nan');
+ expect(parsers.searchUrl('localhost 8080', config))
+ .to.equal('https://google.com/search?q=localhost%208080');
+ expect(parsers.searchUrl('localhost:80/build', config))
+ .to.equal('http://localhost:80/build')
+ })
});
describe('#normalizeUrl', () => {
@@ -47,4 +62,3 @@ describe("shared/commands/parsers", () => {
});
});
});
-