Created
September 7, 2020 08:57
-
-
Save PCreations/37bef12c68bb8366c2b4424215787497 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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