29 lines
923 B
TypeScript
29 lines
923 B
TypeScript
import { describe, expect, it } from "vitest"
|
|
|
|
import { buildAssigneeChangeComment } from "../convex/tickets"
|
|
|
|
describe("buildAssigneeChangeComment", () => {
|
|
it("inclui nomes antigos e novos e quebra o motivo em parágrafos", () => {
|
|
const html = buildAssigneeChangeComment("Transferir para o time B\nCliente solicitou gestor.", {
|
|
previousName: "Ana",
|
|
nextName: "Bruno",
|
|
})
|
|
|
|
expect(html).toContain("Ana")
|
|
expect(html).toContain("Bruno")
|
|
expect(html).toContain("<p>Transferir para o time B</p>")
|
|
expect(html).toContain("<p>Cliente solicitou gestor.</p>")
|
|
})
|
|
|
|
it("escapa caracteres perigosos", () => {
|
|
const html = buildAssigneeChangeComment("<script>alert(1)</script>", {
|
|
previousName: "<Ana>",
|
|
nextName: "Bruno & Co",
|
|
})
|
|
|
|
expect(html).toContain("<Ana>")
|
|
expect(html).toContain("Bruno & Co")
|
|
expect(html).not.toContain("<script>")
|
|
})
|
|
})
|
|
|