feat: persist settings and enrich conversation context
This commit is contained in:
1 parent
a36723a325
commit
2c100d72b6
84 files changed
+2248
-644
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { ActivityLogRepository } from '../src/database/repositories.js';
|
||||
import { ActivityLog } from '../src/web/activity-log.js';
|
||||
import { createTestDb } from './testUtils.js';
|
||||
|
||||
describe('activity origin context', () => {
|
||||
it('persists and hydrates the source post title, URL, and image', () => {
|
||||
const db = createTestDb();
|
||||
const repository = new ActivityLogRepository(db);
|
||||
const activity = new ActivityLog(repository);
|
||||
|
||||
activity.push(
|
||||
'sent',
|
||||
'Sent message to u/alice (r/example)',
|
||||
'alice',
|
||||
'https://i.redd.it/source.jpg',
|
||||
{
|
||||
postTitle: 'Source title',
|
||||
postUrl: 'https://www.reddit.com/r/example/comments/source/source_title/',
|
||||
},
|
||||
);
|
||||
|
||||
expect(new ActivityLog(repository).recent(1)).toEqual([expect.objectContaining({
|
||||
imageUrl: 'https://i.redd.it/source.jpg',
|
||||
postTitle: 'Source title',
|
||||
postUrl: 'https://www.reddit.com/r/example/comments/source/source_title/',
|
||||
})]);
|
||||
db.close();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user