1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { customDecodeURI, customEncodeURI } from './url';
7 describe('url', () => {
8 describe('customDecodeURI', () => {
9 it('should decode encoded URI', () => {
11 const path = 'test%23test%2Ftest';
12 const expectedResult = 'test#test%2Ftest';
15 const result = customDecodeURI(path);
18 expect(result).to.equal(expectedResult);
21 it('ignores non parsable URI and return its original form', () => {
23 const path = 'test/path/with%wrong/sign';
26 const result = customDecodeURI(path);
29 expect(result).to.equal(path);
33 describe('customEncodeURI', () => {
34 it('should encode URI', () => {
36 const path = 'test#test/test';
37 const expectedResult = 'test%23test/test';
40 const result = customEncodeURI(path);
43 expect(result).to.equal(expectedResult);
46 it('ignores non encodable URI and return its original form', () => {
51 const result = customEncodeURI(path);
54 expect(result).to.equal(path);