Skip to content

Commit

Permalink
fix: create test
Browse files Browse the repository at this point in the history
  • Loading branch information
TakahiroHimi committed Oct 16, 2021
1 parent 0cb0488 commit 80d7635
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
import fetchOGP from "../src/index";

describe("test", () => {
test("test", () => {
return expect(fetchOGP(["https://shs.sh/"])).resolves.toBe(true);
test("fetch ogp", () => {
return expect(
fetchOGP(["https://takahirohimi.github.io/ogp-fetcher/"])
).resolves.toStrictEqual([
{
["og:title"]: "title",
["og:description"]: "description",
["og:locale"]: "locale",
["og:type"]: "type",
["og:url"]: "https://example.com",
["og:image:width"]: "200",
["og:image:height"]: "100",
["og:image"]: "https://example.com/image.png",
},
]);
});

test("fetch multiple ogp", () => {
return expect(
fetchOGP([
"https://takahirohimi.github.io/ogp-fetcher/",
"https://takahirohimi.github.io/ogp-fetcher/foo.html",
])
).resolves.toStrictEqual([
{
["og:title"]: "title",
["og:description"]: "description",
["og:locale"]: "locale",
["og:type"]: "type",
["og:url"]: "https://example.com",
["og:image:width"]: "200",
["og:image:height"]: "100",
["og:image"]: "https://example.com/image.png",
},
{
["og:title"]: "footitle",
["og:description"]: "foodescription",
["og:locale"]: "foolocale",
["og:type"]: "footype",
["og:url"]: "https://example.com/foo",
["og:image:width"]: "300",
["og:image:height"]: "200",
["og:image"]: "https://example.com/foo.png",
},
]);
});
});

0 comments on commit 80d7635

Please sign in to comment.