hot.test.js
1 import { describe, expect, it } from 'vitest'; 2 import { buildHotListUrl, getShanghaiDate } from './hot.js'; 3 describe('36kr/hot date routing', () => { 4 it('formats dates in Asia/Shanghai instead of UTC', () => { 5 const date = new Date('2026-03-25T18:30:00.000Z'); 6 expect(getShanghaiDate(date)).toBe('2026-03-26'); 7 }); 8 it('builds dated hot-list routes with Shanghai-local date', () => { 9 const date = new Date('2026-03-25T18:30:00.000Z'); 10 expect(buildHotListUrl('renqi', date)).toBe('https://www.36kr.com/hot-list/renqi/2026-03-26/1'); 11 }); 12 it('keeps catalog on the static route', () => { 13 expect(buildHotListUrl('catalog')).toBe('https://www.36kr.com/hot-list/catalog'); 14 }); 15 });