Skip to content

Instantly share code, notes, and snippets.

@PCreations
Created September 7, 2020 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PCreations/37bef12c68bb8366c2b4424215787497 to your computer and use it in GitHub Desktop.
Save PCreations/37bef12c68bb8366c2b4424215787497 to your computer and use it in GitHub Desktop.
import { createRecentArticlesSitemap } from "../recent-articles-sitemap";
import { createHandler } from "../handler";
jest.mock("../recent-articles-sitemap");
describe("handler", () => {
it("delegates the creation of the sitemap for each domain/language", async () => {
// arrange
const domains = [
{
domain: "www.my-website.fr",
language: "fr-FR",
},
{
domain: "www.my-website.co.uk",
language: "en-GB",
},
];
const recentArticlesSitemap = jest.fn();
createRecentArticlesSitemap.mockImplementation(() => recentArticlesSitemap);
const handler = createHandler({ domains });
// act
await handler();
// assert
expect(recentArticlesSitemap).toHaveBeenNthCalledWith(1, domains[0]);
expect(recentArticlesSitemap).toHaveBeenNthCalledWith(2, domains[1]);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment