Skip to content

Commit 2bf5bbf

Browse files
committed
Update tests
1 parent cbd5768 commit 2bf5bbf

File tree

1 file changed

+22
-33
lines changed

1 file changed

+22
-33
lines changed

__tests__/index.spec.ts

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ describe(`#getLinkPreview()`, () => {
7373
expect(linkInfo.contentType.toLowerCase()).toEqual(`text/html`);
7474
});
7575

76-
xit(`should make request with different languages`, async () => {
77-
let linkInfo: any = await getLinkPreview(`https://www.wikipedia.org/`, {
78-
headers: { "Accept-Language": `es` },
79-
followRedirects: `follow`,
80-
});
81-
expect(linkInfo.title).toContain(`Wikipedia, la enciclopedia libre`);
76+
// it(`should make request with different languages`, async () => {
77+
// let linkInfo: any = await getLinkPreview(`https://www.wikipedia.org/`, {
78+
// headers: { "Accept-Language": `es` },
79+
// followRedirects: `follow`,
80+
// });
81+
// expect(linkInfo.title).toContain(`Wikipedia, la enciclopedia libre`);
8282

83-
linkInfo = await getLinkPreview(`https://www.wikipedia.org/`);
84-
expect(linkInfo.title).toContain(`Wikipedia`);
85-
});
83+
// linkInfo = await getLinkPreview(`https://www.wikipedia.org/`);
84+
// expect(linkInfo.title).toContain(`Wikipedia`);
85+
// });
8686

8787
it(`should handle audio urls`, async () => {
8888
const linkInfo = await getLinkPreview(
@@ -128,18 +128,18 @@ describe(`#getLinkPreview()`, () => {
128128
});
129129

130130
// This site changed? it is not returning application any more but rather website
131-
it.skip(`should handle application urls`, async () => {
132-
const linkInfo = await getLinkPreview(
133-
`https://assets.curtmfg.com/masterlibrary/56282/installsheet/CME_56282_INS.pdf`
134-
);
135-
136-
expect(linkInfo.url).toEqual(
137-
`https://assets.curtmfg.com/masterlibrary/56282/installsheet/CME_56282_INS.pdf`
138-
);
139-
expect(linkInfo.mediaType).toEqual(`application`);
140-
expect(linkInfo.contentType?.toLowerCase()).toEqual(`application/pdf`);
141-
expect(linkInfo.favicons[0]).toBeTruthy();
142-
});
131+
// it.skip(`should handle application urls`, async () => {
132+
// const linkInfo = await getLinkPreview(
133+
// `https://assets.curtmfg.com/masterlibrary/56282/installsheet/CME_56282_INS.pdf`
134+
// );
135+
136+
// expect(linkInfo.url).toEqual(
137+
// `https://assets.curtmfg.com/masterlibrary/56282/installsheet/CME_56282_INS.pdf`
138+
// );
139+
// expect(linkInfo.mediaType).toEqual(`application`);
140+
// expect(linkInfo.contentType?.toLowerCase()).toEqual(`application/pdf`);
141+
// expect(linkInfo.favicons[0]).toBeTruthy();
142+
// });
143143

144144
it(`no link in text should fail gracefully`, async () => {
145145
await expect(
@@ -213,9 +213,7 @@ describe(`#getLinkPreview()`, () => {
213213
try {
214214
await getLinkPreview(`http://google.com/`, { followRedirects: `error` });
215215
} catch (e: any) {
216-
expect(e.message).toEqual(
217-
`fetch failed`
218-
);
216+
expect(e.message).toEqual(`fetch failed`);
219217
}
220218
});
221219

@@ -285,12 +283,3 @@ describe(`#getPreviewFromContent`, () => {
285283
expect(linkInfo.contentType.toLowerCase()).toEqual(`text/html`);
286284
});
287285
});
288-
289-
xdescribe(`simple test`, () => {
290-
it("fetch my repo", async () => {
291-
const linkInfo: any = await getLinkPreview("https://www.pravda.com.ua");
292-
console.warn({ linkInfo });
293-
294-
expect(1).toEqual(2);
295-
});
296-
});

0 commit comments

Comments
 (0)