more localhost use cases

This commit is contained in:
chenchao 2019-11-06 18:13:23 +08:00
parent 5758100f43
commit f3ce1c300a
2 changed files with 25 additions and 3 deletions

View file

@ -36,6 +36,19 @@ 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://locahost:8080');
expect(parsers.searchUrl('localhost:80nan', config))
.to.equal('https://google.com/search?q=localhost:80nan');
expect(parsers.searchUrl('localhost 8080', config))
.to.equal('https://google.com/search?q=localhost%208080');
})
});
describe('#normalizeUrl', () => {
@ -47,4 +60,3 @@ describe("shared/commands/parsers", () => {
});
});
});