Skip to content

Commit

Permalink
Change freedium for readmedium (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
fferrin authored Jul 21, 2024
1 parent ebc45a2 commit ea432e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extension/content.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function freeUrl(url) {
const urlObj = new URL(url)

urlObj.host = "freedium.cfd";
urlObj.host = "readmedium.com";

return urlObj.href;
}
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "FreeMedium",
"version": "1.0",
"version": "2.0",
"description": "An extension to read Medium posts for free.",
"icons": {
"16": "images/icon-16.png",
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/e2e.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-check
import { test, expect } from './fixtures';


const urls = [
'https://somesubdomain.medium.com',
'https://medium.com',
Expand All @@ -11,7 +10,7 @@ const urls = [
for (const url of urls) {
test(`Button exists in "${url}" page`, async ({ page }) => {
const mediumUrl = `${url}/some-post`
const expectedUrl = 'https://freedium.cfd/some-post'
const expectedUrl = 'https://readmedium.com/some-post'

await page.goto(mediumUrl);
expect(page.locator('button#free-medium__button')).toBeDefined();
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/freeUrl.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function freeUrl(url) {
const urlObj = new URL(url)

urlObj.host = "freedium.cfd";
urlObj.host = "readmedium.com";

return urlObj.href;
}
Expand All @@ -10,16 +10,16 @@ function freeUrl(url) {
describe("freeUrl", () => {
it("converts the URLs correctly", () => {
expect(freeUrl("https://medium.com/my-post")).toBe(
"https://freedium.cfd/my-post"
"https://readmedium.com/my-post"
);
expect(freeUrl("https://www.medium.com/my-post")).toBe(
"https://freedium.cfd/my-post"
"https://readmedium.com/my-post"
);
expect(freeUrl("https://some-subdomain.medium.com/my-post")).toBe(
"https://freedium.cfd/my-post"
"https://readmedium.com/my-post"
);
expect(freeUrl("https://medium.com/hackernoon/hello-world-79436a73e443")).toBe(
"https://freedium.cfd/hackernoon/hello-world-79436a73e443"
"https://readmedium.com/hackernoon/hello-world-79436a73e443"
);
});
});

0 comments on commit ea432e6

Please sign in to comment.