feat: Allow superset to be deployed under a prefixed URL (#30134)

Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
This commit is contained in:
Martyn Gigg
2025-04-09 21:43:44 +01:00
committed by GitHub
parent 31ac3898ad
commit 09b92e7d08
100 changed files with 733 additions and 319 deletions

View File

@@ -16,58 +16,67 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ensureAppRoot } from 'src/utils/pathUtils';
import { getChartDataUri } from '.';
test('Get ChartUri when allowDomainSharding:false', () => {
expect(
getChartDataUri({
path: '/path',
qs: 'same-string',
allowDomainSharding: false,
}),
).toEqual({
_deferred_build: true,
_parts: {
duplicateQueryParameters: false,
escapeQuerySpace: true,
fragment: null,
hostname: 'localhost',
password: null,
path: '/path',
port: '',
preventInvalidHostname: false,
protocol: 'http',
query: 'same-string',
urn: null,
username: null,
},
_string: '',
});
});
jest.mock('src/utils/pathUtils');
test('Get ChartUri when allowDomainSharding:true', () => {
expect(
getChartDataUri({
path: '/path-allowDomainSharding-true',
qs: 'same-string-allowDomainSharding-true',
allowDomainSharding: true,
}),
).toEqual({
_deferred_build: true,
_parts: {
duplicateQueryParameters: false,
escapeQuerySpace: true,
fragment: null,
hostname: undefined,
password: null,
path: '/path-allowDomainSharding-true',
port: '',
preventInvalidHostname: false,
protocol: 'http',
query: 'same-string-allowDomainSharding-true',
urn: null,
username: null,
},
_string: '',
describe('Get ChartUri', () => {
(ensureAppRoot as jest.Mock).mockImplementation(
(path: string) => `/prefix${path}`,
);
it('Get ChartUri when allowDomainSharding:false', () => {
expect(
getChartDataUri({
path: '/path',
qs: 'same-string',
allowDomainSharding: false,
}),
).toEqual({
_deferred_build: true,
_parts: {
duplicateQueryParameters: false,
escapeQuerySpace: true,
fragment: null,
hostname: 'localhost',
password: null,
path: '/prefix/path',
port: '',
preventInvalidHostname: false,
protocol: 'http',
query: 'same-string',
urn: null,
username: null,
},
_string: '',
});
});
it('Get ChartUri when allowDomainSharding:true', () => {
expect(
getChartDataUri({
path: '/path-allowDomainSharding-true',
qs: 'same-string-allowDomainSharding-true',
allowDomainSharding: true,
}),
).toEqual({
_deferred_build: true,
_parts: {
duplicateQueryParameters: false,
escapeQuerySpace: true,
fragment: null,
hostname: undefined,
password: null,
path: '/prefix/path-allowDomainSharding-true',
port: '',
preventInvalidHostname: false,
protocol: 'http',
query: 'same-string-allowDomainSharding-true',
urn: null,
username: null,
},
_string: '',
});
});
});