Refactor languageHandler to avoid import cycles (#33948)

* Refactor languageHandler to avoid import cycles

Also move its tests to vitest

* Small refactor

* Iterate

* Iterate
This commit is contained in:
Michael Telatynski
2026-06-24 09:49:49 +00:00
committed by GitHub
parent 29b9c04d20
commit f9b97be1d7
38 changed files with 780 additions and 555 deletions
@@ -27,7 +27,7 @@ import {
DAY_MS,
} from "../../../src/DateUtils";
import { REPEATABLE_DATE, mockIntlDateTimeFormat, unmockIntlDateTimeFormat } from "../../test-utils";
import * as languageHandler from "../../../src/languageHandler";
import * as languageSettings from "../../../src/i18n/settings";
describe("getDaysArray", () => {
it("should return Sunday-Saturday in long mode", () => {
@@ -369,7 +369,7 @@ describe("formatLocalDateShort()", () => {
});
const timestamp = new Date("Fri Dec 17 2021 09:09:00 GMT+0100 (Central European Standard Time)").getTime();
it("formats date correctly by locale", () => {
const locale = jest.spyOn(languageHandler, "getUserLanguage");
const locale = jest.spyOn(languageSettings, "getUserLanguage");
mockIntlDateTimeFormat();
// format is DD/MM/YY