1 | import { es } from "date-fns/locale/es";
|
2 |
|
3 | import { dateLib } from "../lib";
|
4 |
|
5 | import { formatCaption } from "./formatCaption";
|
6 |
|
7 | const date = new Date(2022, 10, 21);
|
8 |
|
9 | test("should return the formatted caption", () => {
|
10 | expect(formatCaption(date, {}, dateLib)).toEqual("November 2022");
|
11 | });
|
12 |
|
13 | describe("when a locale is passed in", () => {
|
14 | test("should format using the locale", () => {
|
15 | expect(formatCaption(date, { locale: es }, dateLib)).toEqual(
|
16 | "noviembre 2022"
|
17 | );
|
18 | });
|
19 | });
|