mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
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:
@@ -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: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user