mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-29 04:39:04 +00:00
linkIsInternal: add test to ensure we don't regress on cases of SLDs
This commit is contained in:
parent
c4356e48f1
commit
1ad1844619
@ -5,6 +5,7 @@ const internalUrlWww = 'https://www.medium.com/';
|
|||||||
const sameBaseDomainUrl = 'https://app.medium.com/';
|
const sameBaseDomainUrl = 'https://app.medium.com/';
|
||||||
const internalUrlCoUk = 'https://medium.co.uk/';
|
const internalUrlCoUk = 'https://medium.co.uk/';
|
||||||
const sameBaseDomainUrlCoUk = 'https://app.medium.co.uk/';
|
const sameBaseDomainUrlCoUk = 'https://app.medium.co.uk/';
|
||||||
|
const differentBaseDomainUrlCoUk = 'https://other.domain.co.uk/';
|
||||||
const internalUrlSubPath = 'topic/technology';
|
const internalUrlSubPath = 'topic/technology';
|
||||||
const externalUrl = 'https://www.wikipedia.org/wiki/Electron';
|
const externalUrl = 'https://www.wikipedia.org/wiki/Electron';
|
||||||
const wildcardRegex = /.*/;
|
const wildcardRegex = /.*/;
|
||||||
@ -53,6 +54,12 @@ test('urls on the same "base domain" should be considered internal, long SLD', (
|
|||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('urls on the a different "base domain" are considered NOT internal, long SLD', () => {
|
||||||
|
expect(
|
||||||
|
linkIsInternal(internalUrlCoUk, differentBaseDomainUrlCoUk, undefined),
|
||||||
|
).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
const testLoginPages = [
|
const testLoginPages = [
|
||||||
'https://amazon.co.uk/signin',
|
'https://amazon.co.uk/signin',
|
||||||
'https://amazon.com/signin',
|
'https://amazon.com/signin',
|
||||||
|
Loading…
Reference in New Issue
Block a user