| 1 |
import { describe, expect, test } from "@odoo/hoot"; |
| 2 |
import { computeSAQRCode } from "@l10n_sa_pos/app/utils/qr"; |
| 3 |
const { DateTime } = luxon; |
| 4 |
|
| 5 |
describe("SA QR Code", () => { |
| 6 |
test("check QR format", () => { |
| 7 |
const date = DateTime.fromISO("2025-03-07T10:15:17"); |
| 8 |
const qrEncoded = computeSAQRCode("SA Company", "123456789012345", date, 100.0, 0); |
| 9 |
const expected = |
| 10 |
"AQpTQSBDb21wYW55Ag8xMjM0NTY3ODkwMTIzNDUDFDAzLzA3LzIwMjUsIDEyOjE1OjE3BAMxMDAFATA="; |
| 11 |
|
| 12 |
expect(qrEncoded).toBe(expected, { |
| 13 |
message: `QR code mismatch: expected "${expected}", got "${qrEncoded}", make sure the timezone is respected`, |
| 14 |
}); |
| 15 |
}); |
| 16 |
}); |