Simplify Threads captions and capture five minutes after sunrise
This commit is contained in:
@@ -3,6 +3,12 @@ import assert from 'node:assert/strict';
|
||||
import { loadCaptions, weatherKey, renderCaption } from '../server/threads/captions.ts';
|
||||
|
||||
const sample = { cloudCover: 10, visibility: 10000, rain: 0, snowfall: 0 };
|
||||
test('default post shows sunrise time rather than the five-minute-later capture time', () => {
|
||||
const config = loadCaptions(new URL('../.threads-captions.sample.json', import.meta.url));
|
||||
const result = renderCaption(config, { weather: { ...sample, cloudCover: 90 }, capturedAt: '2026-11-01T21:58:00Z',
|
||||
sunrise: '2026-11-01T21:53:00Z', url: 'https://sunrise.horoli.kr', test: false });
|
||||
assert.equal(result.text, '오늘의 관악산 일출이에요\n2026.11.02 · 일출 06:53\n날씨: 흐림\nsunrise.horoli.kr');
|
||||
});
|
||||
test('caption weather uses precipitation first and does not assume missing data means clear', () => {
|
||||
const config = loadCaptions();
|
||||
assert.equal(weatherKey({ ...sample, rain: 1, snowfall: 1 }, config), 'snow');
|
||||
|
||||
Reference in New Issue
Block a user