Hours by client: add search and CSV filtering; add alerts cron (BRT 08:00 guard) + alerts panel filters; admin companies shows last alert; PDF Inter font from public/fonts; fix Select empty value; type cleanups; tests for CSV/TZ; remove Knowledge Base nav
This commit is contained in:
parent
2cf399dcb1
commit
08cc8037d5
151 changed files with 1404 additions and 214 deletions
18
tests/csv.test.ts
Normal file
18
tests/csv.test.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { describe, expect, it } from "vitest"
|
||||
import { csvEscape, rowsToCsv } from "@/lib/csv"
|
||||
|
||||
describe("csvEscape", () => {
|
||||
it("escapes quotes and commas", () => {
|
||||
expect(csvEscape('a,b')).toBe('"a,b"')
|
||||
expect(csvEscape('a"b')).toBe('"a""b"')
|
||||
expect(csvEscape('simple')).toBe('simple')
|
||||
})
|
||||
})
|
||||
|
||||
describe("rowsToCsv", () => {
|
||||
it("joins rows and columns with newline and commas", () => {
|
||||
const csv = rowsToCsv([["A", "B"], [1, 2]])
|
||||
expect(csv).toBe("A,B\n1,2\n")
|
||||
})
|
||||
})
|
||||
|
||||
17
tests/time.test.ts
Normal file
17
tests/time.test.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { describe, expect, it } from "vitest"
|
||||
import { dateKeyTZ, getTZParts, isAtHourTZ } from "@/lib/time"
|
||||
|
||||
describe("time tz helpers", () => {
|
||||
it("computes date key in timezone", () => {
|
||||
const d = new Date("2025-10-07T10:30:00.000Z")
|
||||
const key = dateKeyTZ(d, "America/Sao_Paulo")
|
||||
// 2025-10-07 07:30 in Sao Paulo (UTC-3)
|
||||
expect(key).toBe("2025-10-07")
|
||||
})
|
||||
|
||||
it("matches hour in timezone", () => {
|
||||
const d = new Date("2025-10-07T11:00:00.000Z") // 08:00 BRT (no DST)
|
||||
expect(isAtHourTZ(d, "America/Sao_Paulo", 8)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue