fix: version neural audio requests for v0.1.1
This commit is contained in:
+21
-1
@@ -11,6 +11,24 @@ import {
|
||||
// 고정 seed로 재현 가능성을 확보하되 seed를 바꾸면 10문제를 넘는 조합이
|
||||
// 실제로 선택되는지 본다. 오디오 URL도 같은 문장 조합을 가리켜야 한다.
|
||||
describe("출제와 정답 판정", () => {
|
||||
it("목표 WAV 100개 모두 같은 명시적 cache-busting 버전과 정답 mapping을 유지한다", () => {
|
||||
const questions = new Map(
|
||||
Array.from({ length: 200 }, (_, seed) => createQuestions(seed, "mixed"))
|
||||
.flat()
|
||||
.map((q) => [q.id, q]),
|
||||
);
|
||||
expect(questions.size).toBe(100);
|
||||
const versions = new Set<string | null>();
|
||||
for (const q of questions.values()) {
|
||||
const url = new URL(q.audioUrl, "http://localhost");
|
||||
expect(url.origin).toBe("http://localhost");
|
||||
expect(url.pathname).toBe(`/audio/${q.pattern.id}-${q.word.id}.wav`);
|
||||
expect(q.id).toBe(`${q.pattern.id}-${q.word.id}`);
|
||||
expect(q.options).toContain(q.word.answer);
|
||||
versions.add(url.searchParams.get("v"));
|
||||
}
|
||||
expect(versions).toEqual(new Set(["0.1.1"]));
|
||||
});
|
||||
it("실제 보기에 있는 경쟁 단어를 문장에 넣고 청취 연산별 순서를 유지한다", () => {
|
||||
for (let seed = 0; seed < 20; seed++) {
|
||||
for (const q of createQuestions(seed, "choice")) {
|
||||
@@ -43,7 +61,9 @@ describe("출제와 정답 판정", () => {
|
||||
expect(new Set(q.options).size).toBe(4);
|
||||
expect(q.options.filter((o) => o === q.word.answer)).toHaveLength(1);
|
||||
expect(q.sentence).not.toContain("{word}");
|
||||
expect(q.audioUrl).toBe(`/audio/${q.pattern.id}-${q.word.id}.wav`);
|
||||
expect(new URL(q.audioUrl, "http://localhost").pathname).toBe(
|
||||
`/audio/${q.pattern.id}-${q.word.id}.wav`,
|
||||
);
|
||||
});
|
||||
expect(createQuestions(42, "mixed")).toEqual(questions);
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user