feat(feedback): adopt 0–10 recommendation scale (#2438)

* feat(feedback): adopt 10-point recommendation scale

* docs(feedback): keep OSS scale contract self-contained
This commit is contained in:
Miguel Ángel
2026-07-14 15:46:47 -04:00
committed by GitHub
parent d2c8c2d808
commit 990f5c3145
18 changed files with 103 additions and 43 deletions
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { FEEDBACK_RATING_SCALE, parseFeedbackRating } from "./feedbackRating.js";
describe("parseFeedbackRating", () => {
it.each(["0", "10"])("accepts the NPS boundary %s", (raw) => {
expect(parseFeedbackRating(raw)).toBe(Number(raw));
});
it.each(["-1", "11", "4.5", "10x", ""])("rejects invalid rating %j", (raw) => {
expect(parseFeedbackRating(raw)).toBeNull();
});
it("declares the serialized rating scale", () => {
expect(FEEDBACK_RATING_SCALE).toBe(10);
});
});