[QA] #533 언급 적은 식당 제외 필터 — 검증 통과, 회귀 테스트 추가

- 설계서(docs/design/533-min-mentions-filter/README.md) 대비 구현 일치 확인
  (backend RestaurantMapper video_count/min_mentions, frontend 필터 UI)
- dev API 실측: min_mentions 0/1/2/3/5/100 전 구간 경계 위반 0건
  (=2→116개, =3→36개, DISTINCT+서브쿼리 중복 없음, 기존 필터 조합 회귀 없음)
- passesMinMentions()를 lib/filters.ts로 추출(동작 변경 없음)하고
  frontend/__tests__/filters.test.ts 6케이스 추가(경계값/null 처리 등)
- 백엔드 빌드, tsc, 프론트 전체 jest(6 suites, 32 tests) 통과

Refs #533
This commit is contained in:
joungmin
2026-07-27 13:55:41 +09:00
parent c13b976ca3
commit 1815a4c4b2
4 changed files with 72 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
/**
* #533 — passesMinMentions() 순수 함수 단위 테스트.
* 설계서: docs/design/533-min-mentions-filter/README.md
*/
import { passesMinMentions } from "@/lib/filters";
describe("passesMinMentions", () => {
it("minMentions=0(기본)이면 필터 미적용 — 항상 true", () => {
expect(passesMinMentions(0, 0)).toBe(true);
expect(passesMinMentions(null, 0)).toBe(true);
expect(passesMinMentions(100, 0)).toBe(true);
});
it("음수 minMentions도 필터 미적용으로 취급한다", () => {
expect(passesMinMentions(0, -1)).toBe(true);
});
it("video_count 가 minMentions 미만이면 제외(false)", () => {
expect(passesMinMentions(1, 2)).toBe(false);
expect(passesMinMentions(0, 1)).toBe(false);
});
it("video_count 가 minMentions 와 같으면 포함(경계값 포함)", () => {
expect(passesMinMentions(2, 2)).toBe(true);
});
it("video_count 가 minMentions 초과면 포함", () => {
expect(passesMinMentions(5, 2)).toBe(true);
});
it("video_count 가 null/undefined(미산정)이면 0으로 간주한다", () => {
expect(passesMinMentions(null, 2)).toBe(false);
expect(passesMinMentions(undefined, 2)).toBe(false);
expect(passesMinMentions(null, 0)).toBe(true);
});
});