kibana/x-pack/plugins/enterprise_search/common/strip_slashes/index.test.ts
Brandon Kobel 4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00

28 lines
936 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { stripTrailingSlash, stripLeadingSlash } from './';
describe('Strip Trailing Slash helper', () => {
it('strips trailing slashes', () => {
expect(stripTrailingSlash('http://trailing.slash/')).toEqual('http://trailing.slash');
});
it('does nothing if there is no trailing slash', () => {
expect(stripTrailingSlash('http://ok.url')).toEqual('http://ok.url');
});
});
describe('Strip Leading Slash helper', () => {
it('strips leading slashes', () => {
expect(stripLeadingSlash('/some/long/path/')).toEqual('some/long/path/');
});
it('does nothing if there is no trailing slash', () => {
expect(stripLeadingSlash('ok')).toEqual('ok');
});
});