Skip to content

Commit

Permalink
Add tests to demonstrate how selection of sizes works
Browse files Browse the repository at this point in the history
  • Loading branch information
andy128k committed Oct 22, 2022
1 parent 57abca6 commit f34fee2
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions test/__snapshots__/pickedSizes.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should generate favicons of a given size 4`] = `
Object {
"files": Array [],
"html": Array [
"<link rel=\\"icon\\" type=\\"image/x-icon\\" href=\\"/favicon.ico\\">",
"<link rel=\\"icon\\" type=\\"image/png\\" sizes=\\"48x48\\" href=\\"/favicon-48x48.png\\">",
],
"images": Array [
Object {
"contents": null,
"name": "favicon.ico",
},
Object {
"contents": null,
"name": "favicon-48x48.png",
},
],
}
`;
26 changes: 26 additions & 0 deletions test/pickedSizes.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import favicons from "../src";
import { logo_png } from "./util";

test("should generate favicons of a given size", async () => {
expect.assertions(1);
const result = await favicons(logo_png, {
icons: {
favicons: [
{
name: "favicon.ico",
sizes: [
{ width: 48, height: 48 },
{ width: 64, height: 64 },
],
},
"favicon-48x48.png",
],
android: false,
appleIcon: false,
appleStartup: false,
windows: false,
yandex: false,
},
});
await expect(result).toMatchFaviconsSnapshot();
});

0 comments on commit f34fee2

Please sign in to comment.