Skip to content

Commit

Permalink
add tests for subdomain matching
Browse files Browse the repository at this point in the history
Add https://*.hassubdomains.com/* to the test manifests, to prove that
subdomain matching is already working correctly, and allow for other
tests relating to subdomains.
  • Loading branch information
aspiers committed Jan 21, 2024
1 parent 4d48486 commit 5f0a449
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions source/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe.each([
origins: [
'https://github.com/*',
'*://api.github.com/*',
'https://*.hassubdomains.com/*',
'https://gist.github.com/*',
'https://ghe.github.com/*',
],
Expand Down Expand Up @@ -167,6 +168,10 @@ describe.each([
},
],
} as chrome.runtime.Manifest), false);
t.is(isUrlPermittedByManifest('https://hassubdomains.com/', manifest), true);
t.is(isUrlPermittedByManifest('https://hassubdomains.com/foo/', manifest), true);
t.is(isUrlPermittedByManifest('https://subdomain.hassubdomains.com/', manifest), true);
t.is(isUrlPermittedByManifest('https://subdomain.hassubdomains.com/foo/', manifest), true);
});
},
);
3 changes: 2 additions & 1 deletion test-fixtures/manifest-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"alarms",
"https://github.com/*",
"https://api.github.com/*",
"*://api.github.com/*"
"*://api.github.com/*",
"https://*.hassubdomains.com/*"
],
"content_scripts": [
{
Expand Down
3 changes: 2 additions & 1 deletion test-fixtures/manifest-v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"host_permissions": [
"https://github.com/*",
"https://api.github.com/*",
"*://api.github.com/*"
"*://api.github.com/*",
"https://*.hassubdomains.com/*"
],
"content_scripts": [
{
Expand Down
1 change: 1 addition & 0 deletions test-fixtures/reported-after-addition.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"*://api.github.com/*",
"https://gist.github.com/*",
"https://github.com/*",
"https://*.hassubdomains.com/*",
"https://*.github.com/*",
"https://git.example.com/*"
],
Expand Down
3 changes: 2 additions & 1 deletion test-fixtures/reported-at-start.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"origins": [
"*://api.github.com/*",
"https://gist.github.com/*",
"https://github.com/*"
"https://github.com/*",
"https://*.hassubdomains.com/*"
],
"permissions": [
"activeTab",
Expand Down

0 comments on commit 5f0a449

Please sign in to comment.