mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* don't prepend app sub url to paths * simplify logo path * fix(plugins): dynamically prepend appSubUrl for System module resolving to work * fix(sandbox): support dynamic appSuburl prepend when loading plugin module.js * fix tests * update test name * fix tests * update fe + add some tests * refactor(plugins): move wrangleurl to utils, rename to resolveModulePath, update usage * chore: fix a typo * test(plugins): add missing name to utils test * reset test flag --------- Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
import { config } from '@grafana/runtime';
|
|
|
|
import { resolveModulePath } from './utils';
|
|
|
|
describe('resolveModulePath', () => {
|
|
it.each`
|
|
value | expected
|
|
${'http://localhost:3000/public/plugins/my-app-plugin/module.js'} | ${'http://localhost:3000/public/plugins/my-app-plugin/module.js'}
|
|
${'/public/plugins/my-app-plugin/module.js'} | ${'/public/plugins/my-app-plugin/module.js'}
|
|
${'public/plugins/my-app-plugin/module.js'} | ${'/public/plugins/my-app-plugin/module.js'}
|
|
`(
|
|
"Url correct formatting, when calling the rule with correct formatted value: '$value' then result should be '$expected'",
|
|
({ value, expected }) => {
|
|
expect(resolveModulePath(value)).toBe(expected);
|
|
}
|
|
);
|
|
|
|
it.each`
|
|
value | expected
|
|
${'http://localhost:3000/public/plugins/my-app-plugin/module.js'} | ${'http://localhost:3000/public/plugins/my-app-plugin/module.js'}
|
|
${'/public/plugins/my-app-plugin/module.js'} | ${'/public/plugins/my-app-plugin/module.js'}
|
|
${'public/plugins/my-app-plugin/module.js'} | ${'/grafana/public/plugins/my-app-plugin/module.js'}
|
|
`(
|
|
"Url correct formatting, when calling the rule with correct formatted value: '$value' then result should be '$expected'",
|
|
({ value, expected }) => {
|
|
config.appSubUrl = '/grafana';
|
|
|
|
expect(resolveModulePath(value)).toBe(expected);
|
|
}
|
|
);
|
|
});
|