mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* SignIn button - use correct url * Fix SignIn test (#26266) * Don't use absolute URL * post review * Fix snap Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { updateConfig } from '../../config';
|
|
import { getForcedLoginUrl } from './utils';
|
|
|
|
describe('getForcedLoginUrl', () => {
|
|
it.each`
|
|
appSubUrl | url | expected
|
|
${''} | ${'/whatever?a=1&b=2'} | ${'/whatever?a=1&b=2&forceLogin=true'}
|
|
${'/grafana'} | ${'/whatever?a=1&b=2'} | ${'/grafana/whatever?a=1&b=2&forceLogin=true'}
|
|
${'/grafana/test'} | ${'/whatever?a=1&b=2'} | ${'/grafana/test/whatever?a=1&b=2&forceLogin=true'}
|
|
${'/grafana'} | ${''} | ${'/grafana?forceLogin=true'}
|
|
${'/grafana'} | ${'/whatever'} | ${'/grafana/whatever?forceLogin=true'}
|
|
${'/grafana'} | ${'/whatever/'} | ${'/grafana/whatever/?forceLogin=true'}
|
|
`(
|
|
"when appUrl set to '$appUrl' and appSubUrl set to '$appSubUrl' then result should be '$expected'",
|
|
({ appSubUrl, url, expected }) => {
|
|
updateConfig({
|
|
appSubUrl,
|
|
});
|
|
|
|
const result = getForcedLoginUrl(url);
|
|
|
|
expect(result).toBe(expected);
|
|
}
|
|
);
|
|
});
|