이지선다 조회수 자동: 빈 양식에서 조회수 열을 빼고, 올린 뒤 서버가 곡마다 토픽 음원 + MV 조회수를 불러와 더함. 짝은 유튜브 뮤직 노래↔동영상 전환(watch 응답의 counterpart, 쿠키 필요), 조회수는 로그인 없이 player videoDetails.viewCount(안 되면 watch 화면 숫자). quizzes/duel-views.ts가 pending 곡을 한 곡씩 처리(재시작해도 이어서), 쿠키 만료면 남은 곡 모두 이유와 함께 failed. 짝이 없는 곡은 있는 영상 하나만 쓰고 비고 표시. 파일·편집기에 적은 숫자는 그대로 쓰고 다시 불러오기에서 빠짐, 칸을 비우고 저장하면 자동. 편집기: 조회수(토픽·MV)·비고 칸, 불러오는 중 표시와 2초 폴링(저장 안 됨으로 안 잡힘), 조회수 다시 불러오기(전체/곡), 저장 때 편집기의 옛 사본이 서버가 불러온 값을 덮지 않음. 내보내기는 직접 넣은 숫자만 조회수 열에. 파일로 만들기는 조회수 열이 없으면 고른 종류 유지. 014 마이그레이션, 단위·API 테스트, e2e duel 단계, docs 04·10·12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,8 +74,8 @@ test('rows → quiz songs: as written, 순번 order, bad links / no answer / rep
|
||||
|
||||
test('our export reads back to the same songs (answers, own positions, several hints) and the template is valid', () => {
|
||||
const items = [
|
||||
{ songId: null, videoId: 'iIIjS6yDMQo', title: '감옥탈출', artist: '트레일러', titleAnswers: ['구토할배'], artistAnswers: ['trailer'], hints: ['방탈출', '플래시'], fromFile: true, durationSec: null, auto: false, startSec: 12, highlightSec: 61.5, views: null },
|
||||
{ songId: 3, videoId: 'x0-xFqvJ-U8', title: '갓 오브 워 2', artist: '', titleAnswers: [], artistAnswers: [], hints: [], fromFile: false, durationSec: 200, auto: true, startSec: null, highlightSec: null, views: null },
|
||||
{ songId: null, videoId: 'iIIjS6yDMQo', title: '감옥탈출', artist: '트레일러', titleAnswers: ['구토할배'], artistAnswers: ['trailer'], hints: ['방탈출', '플래시'], fromFile: true, durationSec: null, auto: false, startSec: 12, highlightSec: 61.5, views: null, viewsAuto: null },
|
||||
{ songId: 3, videoId: 'x0-xFqvJ-U8', title: '갓 오브 워 2', artist: '', titleAnswers: [], artistAnswers: [], hints: [], fromFile: false, durationSec: 200, auto: true, startSec: null, highlightSec: null, views: null, viewsAuto: null },
|
||||
];
|
||||
const { rows } = quizToRows(items);
|
||||
const text = rows.map((r) => r.map((c) => (c === null ? '' : String(c))));
|
||||
@@ -111,7 +111,7 @@ test('조회수 as people write it', () => {
|
||||
expect(parseViews('많음')).toBeUndefined();
|
||||
});
|
||||
|
||||
test('이지선다 파일: 제목·가수·조회수, rows without views are left out, export and template read back', () => {
|
||||
test('이지선다 파일: 제목·가수, 조회수 optional (empty = fetched by the server), export and template read back', () => {
|
||||
const rows = [
|
||||
['순번', '유튜브 링크', '제목', '가수', '조회수'],
|
||||
['2', 'https://youtu.be/iIIjS6yDMQo', '감옥탈출', '트레일러', '1.2억'],
|
||||
@@ -122,17 +122,23 @@ test('이지선다 파일: 제목·가수·조회수, rows without views are lef
|
||||
const cols = guessColumns(rows[0]!);
|
||||
expect(cols).toEqual(['order', 'link', 'answer', 'desc', 'views']);
|
||||
const p = parseQuizRows(rows, cols, 0, 'duel');
|
||||
expect(p.items.map((i) => [i.title, i.artist, i.views])).toEqual([
|
||||
['갓 오브 워', '', 3456789],
|
||||
['감옥탈출', '트레일러', 120000000],
|
||||
expect(p.items.map((i) => [i.title, i.artist, i.views, i.viewsAuto])).toEqual([
|
||||
['갓 오브 워', '', 3456789, null],
|
||||
['감옥탈출', '트레일러', 120000000, null],
|
||||
['조회수 없음', '누구', null, null],
|
||||
]);
|
||||
expect(p.rows.filter((r) => r.problem).map((r) => [r.line, r.problem])).toEqual([
|
||||
[4, '조회수가 비어 있어요'],
|
||||
[5, '조회수를 읽을 수 없어요 (많음)'],
|
||||
]);
|
||||
const { rows: out } = quizToRows(p.items, 'duel');
|
||||
expect(p.rows.filter((r) => r.problem).map((r) => [r.line, r.problem])).toEqual([[5, '조회수를 읽을 수 없어요 (많음)']]);
|
||||
// export: written numbers come back as written, fetched ones (and empty ones) come back empty
|
||||
const fetched = { state: 'done' as const, topicId: 'aaaaaaaaaaa', topicViews: 10, mvId: 'bbbbbbbbbbb', mvViews: 20, error: null, at: 1 };
|
||||
const withAuto = p.items.map((it, i) => (i === 1 ? { ...it, views: 30, viewsAuto: fetched } : it));
|
||||
const { rows: out } = quizToRows(withAuto, 'duel');
|
||||
expect(out[0]).toEqual(['순번', '유튜브 영상 링크', '제목', '가수', '조회수', '시작(초)', '하이라이트(초)']);
|
||||
const text = out.map((r) => r.map((c) => (c === null ? '' : String(c))));
|
||||
expect(parseQuizRows(text, guessColumns(text[0]!), 0, 'duel').items).toEqual(p.items);
|
||||
expect(parseQuizRows(text, guessColumns(text[0]!), 0, 'duel').items.map((i) => i.views)).toEqual([3456789, null, null]);
|
||||
// nothing written by hand: no 조회수 column at all
|
||||
expect(quizToRows([{ ...p.items[2]! }], 'duel').rows[0]).not.toContain('조회수');
|
||||
// 빈 양식: no 조회수 column, the example row reads back with its views left to the server
|
||||
const t = quizTemplateRows('duel').rows.map((r) => r.map((c) => (c === null ? '' : String(c))));
|
||||
expect(parseQuizRows(t, guessColumns(t[0]!), 0, 'duel').items).toHaveLength(1);
|
||||
expect(t[0]).toEqual(['순번', '유튜브 영상 링크', '제목', '가수', '시작(초)', '하이라이트(초)']);
|
||||
expect(parseQuizRows(t, guessColumns(t[0]!), 0, 'duel').items.map((i) => [i.title, i.views])).toEqual([['라일락', null]]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user