✨feature: First push to git
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { enrichLink } from '../src/enrichment/enricher.js';
|
||||
|
||||
describe('enrichment', () => {
|
||||
it('marks dead, paywall, and unreachable links', async () => {
|
||||
await expect(
|
||||
enrichLink('https://x.test/dead', async () => ({
|
||||
status: 404,
|
||||
finalUrl: 'https://x.test/dead',
|
||||
html: ''
|
||||
}))
|
||||
).resolves.toMatchObject({
|
||||
status: 'dead'
|
||||
});
|
||||
await expect(
|
||||
enrichLink('https://x.test/a', async () => ({
|
||||
status: 200,
|
||||
finalUrl: 'https://x.test/login',
|
||||
html: '<title>Login</title>'
|
||||
}))
|
||||
).resolves.toMatchObject({ status: 'paywall' });
|
||||
await expect(
|
||||
enrichLink('https://x.test/a', async () => Promise.reject(new Error('timeout')))
|
||||
).resolves.toMatchObject({
|
||||
status: 'unreachable'
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user