mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-04 12:20:19 +03:00
test: add a new test for normalizeServers
This commit is contained in:
parent
8db7cc92bb
commit
eba0265e6f
|
@ -425,6 +425,24 @@ describe('Utils', () => {
|
|||
expect(res).toEqual([{ url: 'https://base.com/sandbox/test', description: 'test' }]);
|
||||
});
|
||||
|
||||
it('should remove query string and hash from url', () => {
|
||||
const originalWindow = { ...window };
|
||||
const windowSpy: jest.SpyInstance = jest.spyOn(global, 'window', 'get');
|
||||
windowSpy.mockImplementation(() => ({
|
||||
...originalWindow,
|
||||
location: {
|
||||
...originalWindow.location,
|
||||
href: 'https://base.com/subpath/?param=value#tag',
|
||||
},
|
||||
}));
|
||||
const res = normalizeServers(undefined, [
|
||||
{
|
||||
url: 'sandbox/test',
|
||||
},
|
||||
]);
|
||||
expect(res).toEqual([{ url: 'https://base.com/subpath/sandbox/test', description: '' }]);
|
||||
});
|
||||
|
||||
it('should expand variables', () => {
|
||||
const servers = normalizeServers('', [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user