fix(watchlist): TV country full name + tmdb_rating precision rounding
TMDB's origin_country returns ISO codes (KR), not full names, causing a vault regression from South Korea to KR. buildRecord now prefers production_countries[0].name, falling back to the raw origin_country code only when absent. TMDB also now returns vote_average at full precision (6.537), causing mass diff noise against the vault's 1-decimal convention and spurious rewrites on precision drift alone. tmdb_rating is now rounded to 1 decimal place. Loki fixture updated to realistic TMDB shapes (ISO country code + production_countries) to catch this regression going forward.
This commit is contained in:
parent
fb3f52e4b0
commit
e0e0462836
3 changed files with 38 additions and 4 deletions
|
|
@ -136,6 +136,33 @@ describe('TV crew preservation', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('TV country derivation', () => {
|
||||
test('prefers production_countries full name over raw origin_country code', () => {
|
||||
const r = buildRecord(tvDetail, false, EMPTY_PREV);
|
||||
expect(r.country).toBe('United States of America');
|
||||
});
|
||||
test('no production_countries → falls back to raw origin_country code', () => {
|
||||
const { production_countries, ...noProdCountries } = tvDetail as any;
|
||||
const r = buildRecord(noProdCountries, false, EMPTY_PREV);
|
||||
expect(r.country).toBe('US');
|
||||
});
|
||||
});
|
||||
|
||||
describe('tmdb_rating rounding', () => {
|
||||
test('6.537 → 6.5', () => {
|
||||
expect(buildRecord({ ...tvDetail, vote_average: 6.537 }, false, EMPTY_PREV).tmdbRating).toBe(6.5);
|
||||
});
|
||||
test('7.854 → 7.9', () => {
|
||||
expect(buildRecord({ ...tvDetail, vote_average: 7.854 }, false, EMPTY_PREV).tmdbRating).toBe(7.9);
|
||||
});
|
||||
test('8.2 → 8.2 (unaffected)', () => {
|
||||
expect(buildRecord(tvDetail, false, EMPTY_PREV).tmdbRating).toBe(8.2);
|
||||
});
|
||||
test('null → null', () => {
|
||||
expect(buildRecord({ ...tvDetail, vote_average: null }, false, EMPTY_PREV).tmdbRating).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('eng_name derivation', () => {
|
||||
test('non-Latin original → engName = localized title', () => {
|
||||
const jp = { ...movieDetail, title: 'A Silent Voice: The Movie', original_title: '映画 聲の形' };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue