Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jellizaveta committed Oct 14, 2024
1 parent 5eb91b9 commit 436985f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/scriptlets/href-sanitizer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('Checking if alias name works', (assert) => {
assert.strictEqual(codeByAdgParams, codeByUboParams, 'ubo name - ok');
});

test('Santize href - base64 where link decoded as a string in data-href attribute', (assert) => {
test('Sanitize href - base64 where link decoded as a string in data-href attribute', (assert) => {
const expectedHref = 'https://example.org/';
const elem = createElem('https://google.com/', expectedHref, 'data-href', 'aHR0cHM6Ly9leGFtcGxlLm9yZy8=');
const selector = 'a[href^="https://google.com/';
Expand All @@ -76,7 +76,7 @@ test('Santize href - base64 where link decoded as a string in data-href attribut
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - base64 where link decoded as a string in href attribute', (assert) => {
test('Sanitize href - base64 where link decoded as a string in href attribute', (assert) => {
const expectedHref = 'http://example.com/?v=123';
const hrefWithBase64 = 'http://www.foo.com/out/?aHR0cDovL2V4YW1wbGUuY29tLz92PTEyMw==';
const elem = createElem(hrefWithBase64);
Expand All @@ -88,7 +88,7 @@ test('Santize href - base64 where link decoded as a string in href attribute', (
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - base64 where link decoded in object in href attribute', (assert) => {
test('Sanitize href - base64 where link decoded in object in href attribute', (assert) => {
const expectedHref = 'http://example.com/?v=3468';
const hrefWithBase64 = 'http://www.foo.com/out/?eyJsIjoiaHR0cDovL2V4YW1wbGUuY29tLz92PTM0NjgiLCJjIjoxfQ==';
const elem = createElem(hrefWithBase64);
Expand All @@ -100,7 +100,7 @@ test('Santize href - base64 where link decoded in object in href attribute', (as
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - text content', (assert) => {
test('Sanitize href - text content', (assert) => {
const expectedHref = 'https://example.org/';
const elem = createElem('https://example.com/foo?redirect=https%3A%2F%2Fexample.org%2F', expectedHref);
const selector = 'a[href*="?redirect="]';
Expand All @@ -112,7 +112,7 @@ test('Santize href - text content', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - text content, create element after running scriptlet', (assert) => {
test('Sanitize href - text content, create element after running scriptlet', (assert) => {
const selector = 'a[href*="foo.com"]';
const scriptletArgs = [selector];
runScriptlet(name, scriptletArgs);
Expand All @@ -128,7 +128,7 @@ test('Santize href - text content, create element after running scriptlet', (ass
}, 10);
});

test('Santize href - text content special characters', (assert) => {
test('Sanitize href - text content special characters', (assert) => {
const expectedHref = 'https://example.com/search?q=łódź';
const elem = createElem('https://example.org/foo', expectedHref);
const selector = 'a[href*="//example.org"]';
Expand All @@ -140,7 +140,7 @@ test('Santize href - text content special characters', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - text content, Twitter like case', (assert) => {
test('Sanitize href - text content, Twitter like case', (assert) => {
const elem = createElem('https://example.com/foo', 'https://agrd.io/promo_turk_83off…'); // Link from Twitter/X
const expectedHref = 'https://agrd.io/promo_turk_83off';
const selector = 'a[href*="//example.com"]';
Expand All @@ -152,7 +152,7 @@ test('Santize href - text content, Twitter like case', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - query parameter 1', (assert) => {
test('Sanitize href - query parameter 1', (assert) => {
const elem = createElem('https://example.com/foo?redirect=https://example.org/');
const expectedHref = 'https://example.org/';
const selector = 'a[href*="?redirect="]';
Expand All @@ -165,7 +165,7 @@ test('Santize href - query parameter 1', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - query parameter 2', (assert) => {
test('Sanitize href - query parameter 2', (assert) => {
const elem = createElem('https://greenmangaming.sjv.io/c/3659980/1281797/15105?u=https://www.greenmangaming.com/games/grand-theft-auto-v-premium-edition-pc');
const expectedHref = 'https://www.greenmangaming.com/games/grand-theft-auto-v-premium-edition-pc';
const selector = 'a[href^="https://greenmangaming.sjv.io/c/"][href*="?u="]';
Expand All @@ -178,7 +178,7 @@ test('Santize href - query parameter 2', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - get href from attribute', (assert) => {
test('Sanitize href - get href from attribute', (assert) => {
const expectedHref = 'https://example.org/';
const elem = createElem('https://foo.com/bar', '', 'data-href', expectedHref);
const selector = 'a[href="https://foo.com/bar"]';
Expand All @@ -191,7 +191,7 @@ test('Santize href - get href from attribute', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - invalid URL', (assert) => {
test('Sanitize href - invalid URL', (assert) => {
const expectedHref = 'https://foo.com/bar';
const elem = createElem(expectedHref, 'https://?');
const selector = 'a[href="https://foo.com/bar"]';
Expand All @@ -203,7 +203,7 @@ test('Santize href - invalid URL', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - parameter, invalid URL', (assert) => {
test('Sanitize href - parameter, invalid URL', (assert) => {
const expectedHref = 'https://?example.com/foo?redirect=https://example.org/';
const elem = createElem(expectedHref);
const selector = 'a[href*="?redirect="]';
Expand All @@ -216,7 +216,7 @@ test('Santize href - parameter, invalid URL', (assert) => {
assert.strictEqual(window.hit, 'FIRED');
});

test('Santize href - not allowed protocol', (assert) => {
test('Sanitize href - not allowed protocol', (assert) => {
const expectedHref = 'https://example.com/foo?redirect=javascript:alert(1)';
const elem = createElem(expectedHref);
const selector = 'a[href*="?redirect="]';
Expand Down

0 comments on commit 436985f

Please sign in to comment.