Skip to content
Myr

format-ordinal.test.ts

This file

Path

test/asks/format-ordinal.test.ts

22 lines · 470 bytes · TypeScript

Last changed by

opened format-ordinalby ines-v3964770

History of this file

Take it

1import { expect, test } from "bun:test";23import { format } from "../../src/index.ts";45test("format's Do token prints English ordinals, the teens included", () => {6  const days = [1, 2, 3, 4, 11, 12, 13, 14, 21, 22, 23, 31];78  expect(days.map((day) => format(new Date(Date.UTC(2026, 0, day)), "Do"))).toStrictEqual([9    "1st",10    "2nd",11    "3rd",12    "4th",13    "11th",14    "12th",15    "13th",16    "14th",17    "21st",18    "22nd",19    "23rd",20    "31st",21  ]);22});