70 lines
1.7 KiB
JavaScript
70 lines
1.7 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const root = process.cwd();
|
|
const en = JSON.parse(readFileSync(join(root, "src/i18n/locales/en.json"), "utf8"));
|
|
const da = JSON.parse(readFileSync(join(root, "src/i18n/locales/da.json"), "utf8"));
|
|
|
|
const bookingKeys = [
|
|
"guest_mode_warning",
|
|
"guest_mode_login_prompt",
|
|
"login",
|
|
"select_wash_hall",
|
|
"select_vehicle",
|
|
"is_this_your_vehicle",
|
|
"next_step_addons",
|
|
"product_selection_unavailable",
|
|
"login_for_products",
|
|
"interior_wash",
|
|
"exterior_wash",
|
|
"no_items_in_basket",
|
|
"total",
|
|
"required",
|
|
"expected_date_time",
|
|
"reference",
|
|
"po_number",
|
|
"note",
|
|
"customer_number",
|
|
"enter_customer_number",
|
|
"customer_not_found",
|
|
"pickup",
|
|
"incl_pickup",
|
|
"basket",
|
|
"step_x_of_y",
|
|
"select_a_wash_hall",
|
|
"enter_vehicle",
|
|
"select_products",
|
|
"select_date_time_customer",
|
|
"back",
|
|
"next",
|
|
"go_to_confirmation",
|
|
"missing_wash_hall",
|
|
"missing_customer_number",
|
|
"missing_valid_customer_number",
|
|
"missing_vehicle",
|
|
"missing_date",
|
|
"missing_products",
|
|
"error_copied",
|
|
"guest_info_html",
|
|
"confirm_booking"
|
|
];
|
|
|
|
function findMissingKeys(messages, keys) {
|
|
return keys.filter((key) => !messages[key]);
|
|
}
|
|
|
|
describe("bookings i18n integrity", () => {
|
|
it("has required booking keys in English", () => {
|
|
const messages = en.user_dashboard?.bookings?.book || {};
|
|
const missing = findMissingKeys(messages, bookingKeys);
|
|
expect(missing).toEqual([]);
|
|
});
|
|
|
|
it("has required booking keys in Danish", () => {
|
|
const messages = da.user_dashboard?.bookings?.book || {};
|
|
const missing = findMissingKeys(messages, bookingKeys);
|
|
expect(missing).toEqual([]);
|
|
});
|
|
});
|