Skip to content

Commit ea9b5e1

Browse files
committed
Enhance Capture class with fetch methods
1 parent a7c3283 commit ea9b5e1

File tree

8 files changed

+466
-198
lines changed

8 files changed

+466
-198
lines changed

.prettierrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

__tests__/test.ts

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,81 +2,81 @@ import { Capture } from "../dist";
22

33
const capture = new Capture("test", "test");
44

5-
describe("Capture URL Builder", function () {
6-
describe("Image Requests", function () {
7-
it("should be an object", function () {
8-
expect(capture).toHaveProperty("buildImageUrl");
9-
expect(capture.buildImageUrl).toBeInstanceOf(Function);
10-
});
5+
describe("Capture URL Builder", () => {
6+
describe("Image Requests", () => {
7+
it("should be an object", () => {
8+
expect(capture).toHaveProperty("buildImageUrl");
9+
expect(capture.buildImageUrl).toBeInstanceOf(Function);
10+
});
1111

12-
it("buildImageUrl should return valid url", function () {
13-
const url = capture.buildImageUrl("https://news.ycombinator.com/");
14-
console.log(url);
15-
expect(url).toBe(
16-
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/image?url=https%3A%2F%2Fnews.ycombinator.com%2F"
17-
);
18-
});
12+
it("buildImageUrl should return valid url", () => {
13+
const url = capture.buildImageUrl("https://news.ycombinator.com/");
14+
console.log(url);
15+
expect(url).toBe(
16+
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/image?url=https%3A%2F%2Fnews.ycombinator.com%2F",
17+
);
18+
});
1919

20-
it("buildImageUrl with options should return valid url", function () {
21-
const url = capture.buildImageUrl("https://capture.techulus.in/", {
22-
full: true,
23-
delay: 3,
24-
});
25-
expect(url).toBe(
26-
"https://cdn.capture.techulus.in/test/2cb8b7ed9dbdb5c0db4a5dc4523a0780/image?full=true&delay=3&url=https%3A%2F%2Fcapture.techulus.in%2F"
27-
);
28-
});
29-
});
20+
it("buildImageUrl with options should return valid url", () => {
21+
const url = capture.buildImageUrl("https://capture.techulus.in/", {
22+
full: true,
23+
delay: 3,
24+
});
25+
expect(url).toBe(
26+
"https://cdn.capture.techulus.in/test/2cb8b7ed9dbdb5c0db4a5dc4523a0780/image?full=true&delay=3&url=https%3A%2F%2Fcapture.techulus.in%2F",
27+
);
28+
});
29+
});
3030

31-
describe("PDF Requests", () => {
32-
it("should be an object", function () {
33-
expect(capture).toHaveProperty("buildPdfUrl");
34-
expect(capture.buildPdfUrl).toBeInstanceOf(Function);
35-
});
31+
describe("PDF Requests", () => {
32+
it("should be an object", () => {
33+
expect(capture).toHaveProperty("buildPdfUrl");
34+
expect(capture.buildPdfUrl).toBeInstanceOf(Function);
35+
});
3636

37-
it("buildPdfUrl should return valid url", function () {
38-
const url = capture.buildPdfUrl("https://news.ycombinator.com/");
39-
expect(url).toBe(
40-
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/pdf?url=https%3A%2F%2Fnews.ycombinator.com%2F"
41-
);
42-
});
37+
it("buildPdfUrl should return valid url", () => {
38+
const url = capture.buildPdfUrl("https://news.ycombinator.com/");
39+
expect(url).toBe(
40+
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/pdf?url=https%3A%2F%2Fnews.ycombinator.com%2F",
41+
);
42+
});
4343

44-
it("buildPdfUrl with options should return valid url", function () {
45-
const url = capture.buildPdfUrl("https://capture.techulus.in/", {
46-
full: true,
47-
delay: 3,
48-
});
49-
expect(url).toBe(
50-
"https://cdn.capture.techulus.in/test/2cb8b7ed9dbdb5c0db4a5dc4523a0780/pdf?full=true&delay=3&url=https%3A%2F%2Fcapture.techulus.in%2F"
51-
);
52-
});
53-
});
44+
it("buildPdfUrl with options should return valid url", () => {
45+
const url = capture.buildPdfUrl("https://capture.techulus.in/", {
46+
full: true,
47+
delay: 3,
48+
});
49+
expect(url).toBe(
50+
"https://cdn.capture.techulus.in/test/2cb8b7ed9dbdb5c0db4a5dc4523a0780/pdf?full=true&delay=3&url=https%3A%2F%2Fcapture.techulus.in%2F",
51+
);
52+
});
53+
});
5454

55-
describe("Content Requests", () => {
56-
it("should be an object", function () {
57-
expect(capture).toHaveProperty("buildContentUrl");
58-
expect(capture.buildContentUrl).toBeInstanceOf(Function);
59-
});
55+
describe("Content Requests", () => {
56+
it("should be an object", () => {
57+
expect(capture).toHaveProperty("buildContentUrl");
58+
expect(capture.buildContentUrl).toBeInstanceOf(Function);
59+
});
6060

61-
it("buildContentUrl should return valid url", function () {
62-
const url = capture.buildContentUrl("https://news.ycombinator.com/");
63-
expect(url).toBe(
64-
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/content?url=https%3A%2F%2Fnews.ycombinator.com%2F"
65-
);
66-
});
67-
});
61+
it("buildContentUrl should return valid url", () => {
62+
const url = capture.buildContentUrl("https://news.ycombinator.com/");
63+
expect(url).toBe(
64+
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/content?url=https%3A%2F%2Fnews.ycombinator.com%2F",
65+
);
66+
});
67+
});
6868

69-
describe("Metadata Requests", () => {
70-
it("should be an object", function () {
71-
expect(capture).toHaveProperty("buildMetadataUrl");
72-
expect(capture.buildMetadataUrl).toBeInstanceOf(Function);
73-
});
69+
describe("Metadata Requests", () => {
70+
it("should be an object", () => {
71+
expect(capture).toHaveProperty("buildMetadataUrl");
72+
expect(capture.buildMetadataUrl).toBeInstanceOf(Function);
73+
});
7474

75-
it("buildMetadataUrl should return valid url", function () {
76-
const url = capture.buildMetadataUrl("https://news.ycombinator.com/");
77-
expect(url).toBe(
78-
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/metadata?url=https%3A%2F%2Fnews.ycombinator.com%2F"
79-
);
80-
});
81-
});
75+
it("buildMetadataUrl should return valid url", () => {
76+
const url = capture.buildMetadataUrl("https://news.ycombinator.com/");
77+
expect(url).toBe(
78+
"https://cdn.capture.techulus.in/test/f37d5fb3ee4540a05bf4ffeed6dffa28/metadata?url=https%3A%2F%2Fnews.ycombinator.com%2F",
79+
);
80+
});
81+
});
8282
});

babel.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2-
presets: [
3-
['@babel/preset-env', {targets: {node: 'current'}}],
4-
'@babel/preset-typescript',
5-
],
6-
};
2+
presets: [
3+
["@babel/preset-env", { targets: { node: "current" } }],
4+
"@babel/preset-typescript",
5+
],
6+
};

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": ["dist", "node_modules", "package.json"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true
23+
}
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"quoteStyle": "double"
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)