fp/services/worker/src/processors/getAnnounceUrlDetails.spec.ts
CJ_Clippy 87b054e66f
Some checks failed
ci / test (push) Failing after 4m45s
fp/our CI/CD / build (push) Successful in 58s
restrict playback to logged in visitors
2025-11-19 17:46:35 -08:00

35 lines
1.1 KiB
TypeScript

import { getTweetDates, getTweetId, tweetIdToDate } from "./getAnnounceUrlDetails";
import { test, expect, describe } from 'vitest';
describe('getAnnounceUrlDetails integration', () => {
test("getTweets", async () => {
const testData = [
{
announceUrl: 'https://x.com/ProjektMelody/status/1989881851817988146',
listedDate: '2025-11-16T02:22:58.000Z',
expectedDate: '2025-11-16T02:22:58.347Z'
}, {
announceUrl: 'https://x.com/ProjektMelody/status/1266096281002356736',
listedDate: '2020-05-28T19:57:30.000Z',
expectedDate: '2020-05-28T19:57:30.979Z',
}, {
announceUrl: 'https://x.com/ProjektMelody/status/1481416541493153795',
listedDate: '2022-01-13T00:03:21.000Z',
expectedDate: '2022-01-13T00:03:21.537Z',
}
]
const data = testData.map((datum) => ({ ...datum, date: tweetIdToDate(getTweetId(datum.announceUrl)) }))
for (const datum of data) {
expect(datum.date).toBeTruthy();
expect(new Date(datum.date)).toStrictEqual(new Date(datum.expectedDate));
}
}, 30000);
})