mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
Hello and thank you for wanting to contribute to the MagicMirror² project! **Please make sure that you have followed these 4 rules before submitting your Pull Request:** > 1. Base your pull requests against the `develop` branch. > 2. Include these infos in the description: implement short syntax for clock week > > - Does the pull request solve a **related** issue? n/a > - If so, can you reference the issue like this `Fixes #<issue_number>`? > - What does the pull request accomplish? Use a list if needed. > - If it includes major visual changes please add screenshots. > > 3. Please run `npm run lint:prettier` before submitting so that > style issues are fixed. > 4. Don't forget to add an entry about your changes to > the CHANGELOG.md file.   **Note**: Sometimes the development moves very fast. It is highly recommended that you update your branch of `develop` before creating a pull request to send us your changes. This makes everyone's lives easier (including yours) and helps us out on the development team. Thanks again and have a nice day! --------- Co-authored-by: BugHaver <43462320+lsaadeh@users.noreply.github.com>
78 lines
2.8 KiB
JavaScript
78 lines
2.8 KiB
JavaScript
const helpers = require("../helpers/global-setup");
|
|
|
|
describe("Clock set to spanish language module", () => {
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
describe("with default 24hr clock config", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_24hr.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows date with correct format", async () => {
|
|
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
|
await expect(helpers.testMatch(".clock .date", dateRegex)).resolves.toBe(true);
|
|
});
|
|
|
|
it("shows time in 24hr format", async () => {
|
|
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
|
await expect(helpers.testMatch(".clock .time", timeRegex)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("with default 12hr clock config", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_12hr.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows date with correct format", async () => {
|
|
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
|
await expect(helpers.testMatch(".clock .date", dateRegex)).resolves.toBe(true);
|
|
});
|
|
|
|
it("shows time in 12hr format", async () => {
|
|
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
|
await expect(helpers.testMatch(".clock .time", timeRegex)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("with showPeriodUpper config enabled", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_showPeriodUpper.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows 12hr time with upper case AM/PM", async () => {
|
|
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
|
await expect(helpers.testMatch(".clock .time", timeRegex)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("with showWeek config enabled", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_showWeek.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows week with correct format", async () => {
|
|
const weekRegex = /^Semana [0-9]{1,2}$/;
|
|
await expect(helpers.testMatch(".clock .week", weekRegex)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("with showWeek short config enabled", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_showWeek_short.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows week with correct format", async () => {
|
|
const weekRegex = /^S[0-9]{1,2}$/;
|
|
await expect(helpers.testMatch(".clock .week", weekRegex)).resolves.toBe(true);
|
|
});
|
|
});
|
|
});
|